Issue #2742585 by ZeiP, alexpott, mondrake, klausi, tomasnagy, Krzysztof Domański, sokru, kristiaanvandeneynde, dawehner, jeroenbegyn: Deprecate dangerous assertTrue/False() compatibility overrides in PHPUnit Kernel, Functional and FunctionalJavascript tests
parent
32d95eccd7
commit
19f9474b9b
|
@ -33,7 +33,7 @@ class ActionUninstallTest extends BrowserTestBase {
|
|||
|
||||
$storage = $this->container->get('entity_type.manager')->getStorage('action');
|
||||
$storage->resetCache(['user_block_user_action']);
|
||||
$this->assertTrue($storage->load('user_block_user_action'), 'Configuration entity \'user_block_user_action\' still exists after uninstalling action module.');
|
||||
$this->assertNotEmpty($storage->load('user_block_user_action'), 'Configuration entity \'user_block_user_action\' still exists after uninstalling action module.');
|
||||
|
||||
$admin_user = $this->drupalCreateUser(['administer users']);
|
||||
$this->drupalLogin($admin_user);
|
||||
|
|
|
@ -89,7 +89,7 @@ class ConfigurationTest extends BrowserTestBase {
|
|||
$this->assertNoText($new_action_label, "Make sure the action label does not appear on the overview page after we've deleted the action.");
|
||||
|
||||
$action = Action::load($action_id);
|
||||
$this->assertFalse($action, 'Make sure the action is gone after being deleted.');
|
||||
$this->assertNull($action, 'Make sure the action is gone after being deleted.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -221,10 +221,10 @@ abstract class AggregatorTestBase extends BrowserTestBase {
|
|||
$count_query = \Drupal::entityQuery('aggregator_item')->condition('fid', $feed->id())->count();
|
||||
$this->updateFeedItems($feed, $expected_count);
|
||||
$count = $count_query->execute();
|
||||
$this->assertTrue($count);
|
||||
$this->assertGreaterThan(0, $count);
|
||||
$this->deleteFeedItems($feed);
|
||||
$count = $count_query->execute();
|
||||
$this->assertTrue($count == 0);
|
||||
$this->assertEquals(0, $count);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,7 +47,7 @@ class MigrateAggregatorFeedTest extends MigrateDrupal7TestBase {
|
|||
$this->assertNull($feed->getImage());
|
||||
// As with getLastCheckedTime(), the etag can change as the fixture is
|
||||
// updated normally, so assert that its format is correct.
|
||||
$this->assertTrue(preg_match('/^"[a-z0-9]{32}"$/', $feed->getEtag()));
|
||||
$this->assertRegExp('/^"[a-z0-9]{32}"$/', $feed->getEtag());
|
||||
$this->assertIdentical('0', $feed->getLastModified());
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class IpAddressBlockingTest extends BrowserTestBase {
|
|||
$edit['ip'] = '1.2.3.3';
|
||||
$this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
|
||||
$ip = $connection->query("SELECT iid from {ban_ip} WHERE ip = :ip", [':ip' => $edit['ip']])->fetchField();
|
||||
$this->assertTrue($ip, 'IP address found in database.');
|
||||
$this->assertNotEmpty($ip, 'IP address found in database.');
|
||||
$this->assertRaw(t('The IP address %ip has been banned.', ['%ip' => $edit['ip']]), 'IP address was banned.');
|
||||
|
||||
// Try to block an IP address that's already blocked.
|
||||
|
@ -71,7 +71,7 @@ class IpAddressBlockingTest extends BrowserTestBase {
|
|||
$submit_ip = '1.2.3.4';
|
||||
$this->drupalPostForm('admin/config/people/ban/' . $submit_ip, [], t('Add'));
|
||||
$ip = $connection->query("SELECT iid from {ban_ip} WHERE ip = :ip", [':ip' => $submit_ip])->fetchField();
|
||||
$this->assertTrue($ip, 'IP address found in database');
|
||||
$this->assertNotEmpty($ip, 'IP address found in database');
|
||||
$this->assertRaw(t('The IP address %ip has been banned.', ['%ip' => $submit_ip]), 'IP address was banned.');
|
||||
|
||||
// Submit your own IP address. This fails, although it works when testing
|
||||
|
|
|
@ -46,7 +46,7 @@ class BasicAuthTest extends BrowserTestBase {
|
|||
$this->assertText($account->getAccountName(), 'Account name is displayed.');
|
||||
$this->assertResponse('200', 'HTTP response is OK');
|
||||
$this->mink->resetSessions();
|
||||
$this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
$this->assertNull($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
$this->assertIdentical(strpos($this->drupalGetHeader('Cache-Control'), 'public'), FALSE, 'Cache-Control is not set to public');
|
||||
|
||||
$this->basicAuthGet($url, $account->getAccountName(), $this->randomMachineName());
|
||||
|
@ -74,7 +74,7 @@ class BasicAuthTest extends BrowserTestBase {
|
|||
$this->drupalGet($url);
|
||||
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS');
|
||||
$this->basicAuthGet($url, $account->getAccountName(), $account->pass_raw);
|
||||
$this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
$this->assertNull($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
$this->assertIdentical(strpos($this->drupalGetHeader('Cache-Control'), 'public'), FALSE, 'No page cache response when requesting a cached page with basic auth credentials.');
|
||||
}
|
||||
|
||||
|
|
|
@ -356,11 +356,11 @@ class BlockUiTest extends BrowserTestBase {
|
|||
$arguments = [':message' => 'Only digits are allowed'];
|
||||
$pattern = '//div[contains(@class,"messages messages--error")]/div[contains(text()[2],:message)]';
|
||||
$elements = $this->xpath($pattern, $arguments);
|
||||
$this->assertTrue($elements, 'Plugin error message found in parent form.');
|
||||
$this->assertNotEmpty($elements, 'Plugin error message found in parent form.');
|
||||
|
||||
$error_class_pattern = '//div[contains(@class,"form-item-settings-digits")]/input[contains(@class,"error")]';
|
||||
$error_class = $this->xpath($error_class_pattern);
|
||||
$this->assertTrue($error_class, 'Plugin error class found in parent form.');
|
||||
$this->assertNotEmpty($error_class, 'Plugin error class found in parent form.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -162,10 +162,10 @@ class DisplayBlockTest extends ViewTestBase {
|
|||
$view->displayHandlers->remove('block_1');
|
||||
$view->storage->save();
|
||||
|
||||
$this->assertFalse($block_storage->load($block_1->id()), 'The block for this display was removed.');
|
||||
$this->assertFalse($block_storage->load($block_2->id()), 'The block for this display was removed.');
|
||||
$this->assertTrue($block_storage->load($block_3->id()), 'A block from another view was unaffected.');
|
||||
$this->assertTrue($block_storage->load($block_4->id()), 'A block from another view was unaffected.');
|
||||
$this->assertNull($block_storage->load($block_1->id()), 'The block for this display was removed.');
|
||||
$this->assertNull($block_storage->load($block_2->id()), 'The block for this display was removed.');
|
||||
$this->assertNotEmpty($block_storage->load($block_3->id()), 'A block from another view was unaffected.');
|
||||
$this->assertNotEmpty($block_storage->load($block_4->id()), 'A block from another view was unaffected.');
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertNoBlockAppears($block_1);
|
||||
$this->assertNoBlockAppears($block_2);
|
||||
|
@ -179,8 +179,8 @@ class DisplayBlockTest extends ViewTestBase {
|
|||
$view->displayHandlers->remove('block_1');
|
||||
$view->storage->save();
|
||||
|
||||
$this->assertFalse($block_storage->load($block_3->id()), 'The block for this display was removed.');
|
||||
$this->assertTrue($block_storage->load($block_4->id()), 'A block from another display on the same view was unaffected.');
|
||||
$this->assertNull($block_storage->load($block_3->id()), 'The block for this display was removed.');
|
||||
$this->assertNotEmpty($block_storage->load($block_4->id()), 'A block from another display on the same view was unaffected.');
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertNoBlockAppears($block_3);
|
||||
$this->assertBlockAppears($block_4);
|
||||
|
|
|
@ -117,7 +117,7 @@ class BlockStorageUnitTest extends KernelTestBase {
|
|||
$this->assertSame('content', $entity->getRegion());
|
||||
$this->assertTrue($entity->status());
|
||||
$this->assertEqual($entity->getTheme(), 'stark');
|
||||
$this->assertTrue($entity->uuid());
|
||||
$this->assertNotEmpty($entity->uuid());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -156,7 +156,7 @@ class BlockViewBuilderTest extends KernelTestBase {
|
|||
$build = $this->getBlockRenderArray();
|
||||
$cid = 'entity_view:block:test_block:' . implode(':', \Drupal::service('cache_contexts_manager')->convertTokensToKeys(['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme', 'user.permissions'])->getKeys());
|
||||
$this->renderer->renderRoot($build);
|
||||
$this->assertTrue($this->container->get('cache.render')->get($cid), 'The block render element has been cached.');
|
||||
$this->assertNotEmpty($this->container->get('cache.render')->get($cid), 'The block render element has been cached.');
|
||||
|
||||
// Re-save the block and check that the cache entry has been deleted.
|
||||
$this->block->save();
|
||||
|
@ -170,7 +170,7 @@ class BlockViewBuilderTest extends KernelTestBase {
|
|||
$build['#block'] = $this->block;
|
||||
|
||||
$this->renderer->renderRoot($build);
|
||||
$this->assertTrue($this->container->get('cache.render')->get($cid), 'The block render element has been cached.');
|
||||
$this->assertNotEmpty($this->container->get('cache.render')->get($cid), 'The block render element has been cached.');
|
||||
$this->block->delete();
|
||||
$this->assertFalse($this->container->get('cache.render')->get($cid), 'The block render cache entry has been cleared when the block was deleted.');
|
||||
|
||||
|
@ -307,7 +307,7 @@ class BlockViewBuilderTest extends KernelTestBase {
|
|||
$final_cache_contexts = Cache::mergeContexts($expected_contexts, $required_cache_contexts);
|
||||
$cid = implode(':', $expected_keys) . ':' . implode(':', \Drupal::service('cache_contexts_manager')->convertTokensToKeys($final_cache_contexts)->getKeys());
|
||||
$cache_item = $this->container->get('cache.render')->get($cid);
|
||||
$this->assertTrue($cache_item, 'The block render element has been cached with the expected cache ID.');
|
||||
$this->assertNotEmpty($cache_item, 'The block render element has been cached with the expected cache ID.');
|
||||
$this->assertIdentical(Cache::mergeTags($expected_tags, ['rendered']), $cache_item->tags);
|
||||
$this->assertIdentical($final_cache_contexts, $cache_item->data['#cache']['contexts']);
|
||||
$this->assertIdentical($expected_tags, $cache_item->data['#cache']['tags']);
|
||||
|
|
|
@ -72,7 +72,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
|
|||
->getStorage('block_content')
|
||||
->loadByProperties(['info' => $edit['info[0][value]']]);
|
||||
$block = reset($blocks);
|
||||
$this->assertTrue($block, 'Custom Block found in database.');
|
||||
$this->assertNotEmpty($block, 'Custom Block found in database.');
|
||||
|
||||
// Check that attempting to create another block with the same value for
|
||||
// 'info' returns an error.
|
||||
|
@ -154,7 +154,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
|
|||
->getStorage('block_content')
|
||||
->loadByProperties(['info' => $edit['info[0][value]']]);
|
||||
$block = reset($blocks);
|
||||
$this->assertTrue($block, 'Custom Block found in database.');
|
||||
$this->assertNotEmpty($block, 'Custom Block found in database.');
|
||||
|
||||
// Check that attempting to create another block with the same value for
|
||||
// 'info' returns an error.
|
||||
|
@ -191,7 +191,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
|
|||
->getStorage('block_content')
|
||||
->loadByProperties(['info' => $edit['info[0][value]']]);
|
||||
$block = reset($blocks);
|
||||
$this->assertTrue($block, 'Default Custom Block found in database.');
|
||||
$this->assertNotEmpty($block, 'Default Custom Block found in database.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,7 +39,7 @@ class BlockContentListTest extends BlockContentTestBase {
|
|||
|
||||
// Test for the table.
|
||||
$element = $this->xpath('//div[@class="layout-content"]//table');
|
||||
$this->assertTrue($element, 'Configuration entity list table found.');
|
||||
$this->assertNotEmpty($element, 'Configuration entity list table found.');
|
||||
|
||||
// Test the table header.
|
||||
$elements = $this->xpath('//div[@class="layout-content"]//table/thead/tr/th');
|
||||
|
|
|
@ -41,7 +41,7 @@ class BlockContentListViewsTest extends BlockContentTestBase {
|
|||
|
||||
// Test for the table.
|
||||
$element = $this->xpath('//div[@class="layout-content"]//table');
|
||||
$this->assertTrue($element, 'Views table found.');
|
||||
$this->assertNotEmpty($element, 'Views table found.');
|
||||
|
||||
// Test the table header.
|
||||
$elements = $this->xpath('//div[@class="layout-content"]//table/thead/tr/th');
|
||||
|
|
|
@ -56,7 +56,7 @@ class BlockContentSaveTest extends BlockContentTestBase {
|
|||
|
||||
// Test the import saved.
|
||||
$block_by_id = BlockContent::load($test_id);
|
||||
$this->assertTrue($block_by_id, 'Custom block load by block ID.');
|
||||
$this->assertNotEmpty($block_by_id, 'Custom block load by block ID.');
|
||||
$this->assertIdentical($block_by_id->body->value, $block_array['body']['value']);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
|
|||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$block_type = BlockContentType::load('foo');
|
||||
$this->assertTrue($block_type, 'The new block type has been created.');
|
||||
$this->assertInstanceOf(BlockContentType::class, $block_type, 'The new block type has been created.');
|
||||
|
||||
$field_definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions('block_content', 'foo');
|
||||
$this->assertTrue(isset($field_definitions['body']), 'Body field created when using the UI to create block content types.');
|
||||
|
@ -90,7 +90,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
|
|||
$this->assertFalse(isset($field_definitions['body']), "Body field for 'other' block type not created when using the testing API to create block content types.");
|
||||
|
||||
$block_type = BlockContentType::load('other');
|
||||
$this->assertTrue($block_type, 'The new block type has been created.');
|
||||
$this->assertInstanceOf(BlockContentType::class, $block_type, 'The new block type has been created.');
|
||||
|
||||
$this->drupalGet('block/add/' . $block_type->id());
|
||||
$this->assertResponse(200);
|
||||
|
|
|
@ -40,7 +40,7 @@ class PageEditTest extends BlockContentTestBase {
|
|||
// Check that the block exists in the database.
|
||||
$blocks = \Drupal::entityQuery('block_content')->condition('info', $edit['info[0][value]'])->execute();
|
||||
$block = BlockContent::load(reset($blocks));
|
||||
$this->assertTrue($block, 'Custom block found in database.');
|
||||
$this->assertNotEmpty($block, 'Custom block found in database.');
|
||||
|
||||
// Load the edit page.
|
||||
$this->drupalGet('block/' . $block->id());
|
||||
|
|
|
@ -70,7 +70,7 @@ class BookContentModerationTest extends BrowserTestBase {
|
|||
];
|
||||
$this->drupalPostForm('node/add/book', $edit, t('Save'));
|
||||
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
|
||||
$this->assertTrue($node);
|
||||
$this->assertNotEmpty($node);
|
||||
|
||||
$edit = [
|
||||
'moderation_state[0][state]' => 'draft',
|
||||
|
|
|
@ -61,7 +61,7 @@ class CKEditorAdminTest extends BrowserTestBase {
|
|||
|
||||
// Ensure no Editor config entity exists yet.
|
||||
$editor = Editor::load('filtered_html');
|
||||
$this->assertFalse($editor, 'No Editor config entity exists yet.');
|
||||
$this->assertNull($editor, 'No Editor config entity exists yet.');
|
||||
|
||||
// Verify the "Text Editor" <select> when a text editor is available.
|
||||
$select = $this->xpath('//select[@name="editor[editor]"]');
|
||||
|
@ -117,7 +117,7 @@ class CKEditorAdminTest extends BrowserTestBase {
|
|||
// Keep the "CKEditor" editor selected and click the "Configure" button.
|
||||
$this->drupalPostForm(NULL, $edit, 'editor_configure');
|
||||
$editor = Editor::load('filtered_html');
|
||||
$this->assertFalse($editor, 'No Editor config entity exists yet.');
|
||||
$this->assertNull($editor, 'No Editor config entity exists yet.');
|
||||
|
||||
// Ensure that drupalSettings is correct.
|
||||
$ckeditor_settings_toolbar = [
|
||||
|
@ -266,9 +266,9 @@ class CKEditorAdminTest extends BrowserTestBase {
|
|||
];
|
||||
$this->drupalPostForm(NULL, $edit, 'editor_configure');
|
||||
$filter_format = FilterFormat::load('amazing_format');
|
||||
$this->assertFalse($filter_format, 'No FilterFormat config entity exists yet.');
|
||||
$this->assertNull($filter_format, 'No FilterFormat config entity exists yet.');
|
||||
$editor = Editor::load('amazing_format');
|
||||
$this->assertFalse($editor, 'No Editor config entity exists yet.');
|
||||
$this->assertNull($editor, 'No Editor config entity exists yet.');
|
||||
|
||||
// Ensure the toolbar buttons configuration value is initialized to the
|
||||
// default value.
|
||||
|
|
|
@ -95,19 +95,19 @@ class CommentCSSTest extends CommentTestBase {
|
|||
// Verify the by-anonymous class.
|
||||
$comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "by-anonymous")]');
|
||||
if ($case['comment_uid'] == 0) {
|
||||
$this->assertTrue(count($comments) == 1, 'by-anonymous class found.');
|
||||
$this->assertCount(1, $comments, 'by-anonymous class found.');
|
||||
}
|
||||
else {
|
||||
$this->assertFalse(count($comments), 'by-anonymous class not found.');
|
||||
$this->assertCount(0, $comments, 'by-anonymous class not found.');
|
||||
}
|
||||
|
||||
// Verify the by-node-author class.
|
||||
$comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "by-node-author")]');
|
||||
if ($case['comment_uid'] > 0 && $case['comment_uid'] == $case['node_uid']) {
|
||||
$this->assertTrue(count($comments) == 1, 'by-node-author class found.');
|
||||
$this->assertCount(1, $comments, 'by-node-author class found.');
|
||||
}
|
||||
else {
|
||||
$this->assertFalse(count($comments), 'by-node-author class not found.');
|
||||
$this->assertCount(0, $comments, 'by-node-author class not found.');
|
||||
}
|
||||
|
||||
// Verify the data-comment-user-id attribute, which is used by the
|
||||
|
@ -121,10 +121,10 @@ class CommentCSSTest extends CommentTestBase {
|
|||
// Verify the unpublished class.
|
||||
$comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "unpublished")]');
|
||||
if ($case['comment_status'] == CommentInterface::NOT_PUBLISHED && $case['user'] == 'admin') {
|
||||
$this->assertTrue(count($comments) == 1, 'unpublished class found.');
|
||||
$this->assertCount(1, $comments, 'unpublished class found.');
|
||||
}
|
||||
else {
|
||||
$this->assertFalse(count($comments), 'unpublished class not found.');
|
||||
$this->assertCount(0, $comments, 'unpublished class not found.');
|
||||
}
|
||||
|
||||
// Verify the data-comment-timestamp attribute, which is used by the
|
||||
|
|
|
@ -45,7 +45,7 @@ class CommentFieldsTest extends CommentTestBase {
|
|||
// Check that the 'comment_body' field is not deleted since it is persisted
|
||||
// even if it has no fields.
|
||||
$field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
|
||||
$this->assertTrue($field_storage, 'The comment_body field storage was not deleted');
|
||||
$this->assertInstanceOf(FieldStorageConfig::class, $field_storage, 'The comment_body field storage was not deleted');
|
||||
|
||||
// Create a new content type.
|
||||
$type_name = 'test_node_type_2';
|
||||
|
@ -55,7 +55,7 @@ class CommentFieldsTest extends CommentTestBase {
|
|||
// Check that the 'comment_body' field exists and has an instance on the
|
||||
// new comment bundle.
|
||||
$field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
|
||||
$this->assertTrue($field_storage, 'The comment_body field exists');
|
||||
$this->assertInstanceOf(FieldStorageConfig::class, $field_storage, 'The comment_body field exists');
|
||||
$field = FieldConfig::loadByName('comment', 'comment', 'comment_body');
|
||||
$this->assertTrue(isset($field), new FormattableMarkup('The comment_body field is present for comments on type @type', ['@type' => $type_name]));
|
||||
|
||||
|
|
|
@ -178,21 +178,21 @@ class CommentInterfaceTest extends CommentTestBase {
|
|||
|
||||
// Attempt to post to node with comments disabled.
|
||||
$this->node = $this->drupalCreateNode(['type' => 'article', 'promote' => 1, 'comment' => [['status' => CommentItemInterface::HIDDEN]]]);
|
||||
$this->assertTrue($this->node, 'Article node created.');
|
||||
$this->assertNotNull($this->node, 'Article node created.');
|
||||
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
|
||||
$this->assertResponse(403);
|
||||
$this->assertNoField('edit-comment', 'Comment body field found.');
|
||||
|
||||
// Attempt to post to node with read-only comments.
|
||||
$this->node = $this->drupalCreateNode(['type' => 'article', 'promote' => 1, 'comment' => [['status' => CommentItemInterface::CLOSED]]]);
|
||||
$this->assertTrue($this->node, 'Article node created.');
|
||||
$this->assertNotNull($this->node, 'Article node created.');
|
||||
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
|
||||
$this->assertResponse(403);
|
||||
$this->assertNoField('edit-comment', 'Comment body field found.');
|
||||
|
||||
// Attempt to post to node with comments enabled (check field names etc).
|
||||
$this->node = $this->drupalCreateNode(['type' => 'article', 'promote' => 1, 'comment' => [['status' => CommentItemInterface::OPEN]]]);
|
||||
$this->assertTrue($this->node, 'Article node created.');
|
||||
$this->assertNotNull($this->node, 'Article node created.');
|
||||
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
|
||||
$this->assertNoText('This discussion is closed', 'Posting to node with comments enabled');
|
||||
$this->assertField('edit-comment-body-0-value', 'Comment body field found.');
|
||||
|
|
|
@ -24,9 +24,9 @@ class CommentNodeChangesTest extends CommentTestBase {
|
|||
public function testNodeDeletion() {
|
||||
$this->drupalLogin($this->webUser);
|
||||
$comment = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName());
|
||||
$this->assertTrue($comment->id(), 'The comment could be loaded.');
|
||||
$this->assertInstanceOf(Comment::class, $comment, 'The comment could be loaded.');
|
||||
$this->node->delete();
|
||||
$this->assertFalse(Comment::load($comment->id()), 'The comment could not be loaded after the node was deleted.');
|
||||
$this->assertNull(Comment::load($comment->id()), 'The comment could not be loaded after the node was deleted.');
|
||||
// Make sure the comment field storage and all its fields are deleted when
|
||||
// the node type is deleted.
|
||||
$this->assertNotNull(FieldStorageConfig::load('node.comment'), 'Comment field storage exists');
|
||||
|
|
|
@ -432,7 +432,7 @@ class CommentNonNodeTest extends BrowserTestBase {
|
|||
|
||||
// Check the field contains the correct comment type.
|
||||
$field_storage = FieldStorageConfig::load('entity_test.field_barfoo');
|
||||
$this->assertTrue($field_storage);
|
||||
$this->assertInstanceOf(FieldStorageConfig::class, $field_storage);
|
||||
$this->assertEqual($field_storage->getSetting('comment_type'), 'foobar');
|
||||
$this->assertEqual($field_storage->getCardinality(), 1);
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ abstract class CommentTestBase extends BrowserTestBase {
|
|||
* Contact info is available.
|
||||
*/
|
||||
public function commentContactInfoAvailable() {
|
||||
return preg_match('/(input).*?(name="name").*?(input).*?(name="mail").*?(input).*?(name="homepage")/s', $this->getSession()->getPage()->getContent());
|
||||
return (bool) preg_match('/(input).*?(name="name").*?(input).*?(name="mail").*?(input).*?(name="homepage")/s', $this->getSession()->getPage()->getContent());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,7 +81,7 @@ class CommentTitleTest extends CommentTestBase {
|
|||
$comment_permalink = $this->cssSelect('.permalink');
|
||||
$comment_permalink = $comment_permalink[0]->getAttribute('href');
|
||||
// Tests that the comment's title link contains the url fragment.
|
||||
$this->assertTrue(strpos($comment_permalink, '#comment-' . $comment1->id()), "The comment's title link contains the url fragment.");
|
||||
$this->assertContains('#comment-' . $comment1->id(), $comment_permalink, "The comment's title link contains the url fragment.");
|
||||
$this->assertEqual($comment1->permalink()->toString(), $comment_permalink, "The comment's title has the correct link.");
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class CommentTypeTest extends CommentTestBase {
|
|||
$type = $this->createCommentType('other');
|
||||
|
||||
$comment_type = CommentType::load('other');
|
||||
$this->assertTrue($comment_type, 'The new comment type has been created.');
|
||||
$this->assertInstanceOf(CommentType::class, $comment_type, 'The new comment type has been created.');
|
||||
|
||||
// Log in a test user.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
@ -76,7 +76,7 @@ class CommentTypeTest extends CommentTestBase {
|
|||
];
|
||||
$this->drupalPostForm('admin/structure/comment/types/add', $edit, t('Save'));
|
||||
$comment_type = CommentType::load('foo');
|
||||
$this->assertTrue($comment_type, 'The new comment type has been created.');
|
||||
$this->assertInstanceOf(CommentType::class, $comment_type, 'The new comment type has been created.');
|
||||
|
||||
// Check that the comment type was created in site default language.
|
||||
$default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId();
|
||||
|
@ -114,7 +114,7 @@ class CommentTypeTest extends CommentTestBase {
|
|||
$this->assertRaw('Bar', 'New name was displayed.');
|
||||
$this->clickLink('Manage fields');
|
||||
$this->assertUrl(Url::fromRoute('entity.comment.field_ui_fields', ['comment_type' => 'comment'], ['absolute' => TRUE])->toString(), [], 'Original machine name was used in URL.');
|
||||
$this->assertTrue($this->cssSelect('tr#comment-body'), 'Body field exists.');
|
||||
$this->assertCount(1, $this->cssSelect('tr#comment-body'), 'Body field exists.');
|
||||
|
||||
// Remove the body field.
|
||||
$this->drupalPostForm('admin/structure/comment/manage/comment/fields/comment.comment.comment_body/delete', [], t('Delete'));
|
||||
|
@ -122,7 +122,7 @@ class CommentTypeTest extends CommentTestBase {
|
|||
$this->drupalPostForm('admin/structure/comment/manage/comment', [], t('Save'));
|
||||
// Check that the body field doesn't exist.
|
||||
$this->drupalGet('admin/structure/comment/manage/comment/fields');
|
||||
$this->assertFalse($this->cssSelect('tr#comment-body'), 'Body field does not exist.');
|
||||
$this->assertCount(0, $this->cssSelect('tr#comment-body'), 'Body field does not exist.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,7 +39,7 @@ class CommentAdminViewUpdateTest extends UpdatePathTestBase {
|
|||
/** @var \Drupal\views\ViewEntityInterface $comment_admin_view */
|
||||
$comment_admin_view = $entity_type_manager->getStorage('view')->load('comment');
|
||||
$this->assertNotNull($comment_admin_view, 'Comment admin view exist in storage.');
|
||||
$this->assertTrue($comment_admin_view->enable(), 'Comment admin view is enabled.');
|
||||
$this->assertTrue((bool) $comment_admin_view->enable()->get('status'), 'Comment admin view is enabled.');
|
||||
$comment_delete_action = $entity_type_manager->getStorage('action')->load('comment_delete_action');
|
||||
$this->assertNotNull($comment_delete_action, 'Comment delete action imported');
|
||||
// Verify comment admin page is working after updates.
|
||||
|
|
|
@ -88,10 +88,10 @@ class WizardTest extends WizardTestBase {
|
|||
// Check for the default filters.
|
||||
$this->assertEqual($view->filter['status']->table, 'comment_field_data');
|
||||
$this->assertEqual($view->filter['status']->field, 'status');
|
||||
$this->assertTrue($view->filter['status']->value);
|
||||
$this->assertEquals('1', $view->filter['status']->value);
|
||||
$this->assertEqual($view->filter['status_node']->table, 'node_field_data');
|
||||
$this->assertEqual($view->filter['status_node']->field, 'status');
|
||||
$this->assertTrue($view->filter['status_node']->value);
|
||||
$this->assertEquals('1', $view->filter['status_node']->value);
|
||||
|
||||
// Check for the default fields.
|
||||
$this->assertEqual($view->field['subject']->table, 'comment_field_data');
|
||||
|
|
|
@ -92,7 +92,7 @@ class CommentLinksTest extends CommentViewsKernelTestBase {
|
|||
|
||||
// Check if I can see the comment approve link on an approved comment.
|
||||
$approve_comment = $view->style_plugin->getField(1, 'approve_comment');
|
||||
$this->assertFalse((string) $approve_comment, "Didn't find a comment approve link for an already approved comment.");
|
||||
$this->assertEmpty((string) $approve_comment, "Didn't find a comment approve link for an already approved comment.");
|
||||
|
||||
// Check if I can see the comment approve link on an approved comment as an
|
||||
// anonymous user.
|
||||
|
@ -104,7 +104,7 @@ class CommentLinksTest extends CommentViewsKernelTestBase {
|
|||
$view = Views::getView('test_comment');
|
||||
$view->preview();
|
||||
$replyto_comment = $view->style_plugin->getField(0, 'approve_comment');
|
||||
$this->assertFalse((string) $replyto_comment, "I can't approve the comment as an anonymous user.");
|
||||
$this->assertEmpty((string) $replyto_comment, "I can't approve the comment as an anonymous user.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -166,7 +166,7 @@ class CommentLinksTest extends CommentViewsKernelTestBase {
|
|||
|
||||
// Check if I can see the reply link on an unapproved comment.
|
||||
$replyto_comment = $view->style_plugin->getField(0, 'replyto_comment');
|
||||
$this->assertFalse((string) $replyto_comment, "I can't reply to an unapproved comment.");
|
||||
$this->assertEmpty((string) $replyto_comment, "I can't reply to an unapproved comment.");
|
||||
|
||||
// Approve the comment.
|
||||
$comment->setPublished();
|
||||
|
@ -189,7 +189,7 @@ class CommentLinksTest extends CommentViewsKernelTestBase {
|
|||
$view = Views::getView('test_comment');
|
||||
$view->preview();
|
||||
$replyto_comment = $view->style_plugin->getField(0, 'replyto_comment');
|
||||
$this->assertFalse((string) $replyto_comment, "Didn't find the comment reply link as an anonymous user.");
|
||||
$this->assertEmpty((string) $replyto_comment, "Didn't find the comment reply link as an anonymous user.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ class ConfigDependencyWebTest extends BrowserTestBase {
|
|||
$this->assertText($entity2->id(), 'Entity2 id found');
|
||||
$this->drupalPostForm($entity1->toUrl('delete-form'), [], 'Delete');
|
||||
$storage->resetCache();
|
||||
$this->assertFalse($storage->loadMultiple([$entity1->id(), $entity2->id()]), 'Test entities deleted');
|
||||
$this->assertEmpty($storage->loadMultiple([$entity1->id(), $entity2->id()]), 'Test entities deleted');
|
||||
|
||||
// Set a more complicated test where dependencies will be fixed.
|
||||
// Entity1 will be deleted by the test.
|
||||
|
@ -122,12 +122,12 @@ class ConfigDependencyWebTest extends BrowserTestBase {
|
|||
$this->assertNoText($entity3->id(), 'Entity3 id not found');
|
||||
$this->drupalPostForm($entity1->toUrl('delete-form'), [], 'Delete');
|
||||
$storage->resetCache();
|
||||
$this->assertFalse($storage->load('entity1'), 'Test entity 1 deleted');
|
||||
$this->assertNull($storage->load('entity1'), 'Test entity 1 deleted');
|
||||
$entity2 = $storage->load('entity2');
|
||||
$this->assertTrue($entity2, 'Entity 2 not deleted');
|
||||
$this->assertNotEmpty($entity2, 'Entity 2 not deleted');
|
||||
$this->assertEquals([], $entity2->calculateDependencies()->getDependencies()['config'], 'Entity 2 dependencies updated to remove dependency on Entity1.');
|
||||
$entity3 = $storage->load('entity3');
|
||||
$this->assertTrue($entity3, 'Entity 3 not deleted');
|
||||
$this->assertNotEmpty($entity3, 'Entity 3 not deleted');
|
||||
$this->assertEquals([$entity2->getConfigDependencyName()], $entity3->calculateDependencies()->getDependencies()['config'], 'Entity 3 still depends on Entity 2.');
|
||||
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class ConfigEntityListTest extends BrowserTestBase {
|
|||
$controller = \Drupal::entityTypeManager()->getListBuilder('config_test');
|
||||
|
||||
// Test getStorage() method.
|
||||
$this->assertTrue($controller->getStorage() instanceof EntityStorageInterface, 'EntityStorage instance in storage.');
|
||||
$this->assertInstanceOf(EntityStorageInterface::class, $controller->getStorage(), 'EntityStorage instance in storage.');
|
||||
|
||||
// Get a list of ConfigTest entities and confirm that it contains the
|
||||
// ConfigTest entity provided by the config_test module.
|
||||
|
@ -54,8 +54,7 @@ class ConfigEntityListTest extends BrowserTestBase {
|
|||
$list = $controller->load();
|
||||
$this->assertCount(1, $list, '1 ConfigTest entity found.');
|
||||
$entity = $list['dotted.default'];
|
||||
$this->assertTrue(!empty($entity), '"Default" ConfigTest entity ID found.');
|
||||
$this->assertTrue($entity instanceof ConfigTest, '"Default" ConfigTest entity is an instance of ConfigTest.');
|
||||
$this->assertInstanceOf(ConfigTest::class, $entity, '"Default" ConfigTest entity is an instance of ConfigTest.');
|
||||
|
||||
// Test getOperations() method.
|
||||
$expected_operations = [
|
||||
|
@ -167,7 +166,7 @@ class ConfigEntityListTest extends BrowserTestBase {
|
|||
|
||||
// Test for the table.
|
||||
$element = $this->xpath('//div[@class="layout-content"]//table');
|
||||
$this->assertTrue($element, 'Configuration entity list table found.');
|
||||
$this->assertCount(1, $element, 'Configuration entity list table found.');
|
||||
|
||||
// Test the table header.
|
||||
$elements = $this->xpath('//div[@class="layout-content"]//table/thead/tr/th');
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Drupal\Tests\config\Functional;
|
||||
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Component\Uuid\Uuid;
|
||||
use Drupal\Core\Entity\EntityMalformedException;
|
||||
use Drupal\Core\Entity\EntityStorageException;
|
||||
use Drupal\Core\Config\Entity\ConfigEntityStorage;
|
||||
|
@ -42,7 +43,6 @@ class ConfigEntityTest extends BrowserTestBase {
|
|||
// Verify default properties on a newly created empty entity.
|
||||
$storage = \Drupal::entityTypeManager()->getStorage('config_test');
|
||||
$empty = $storage->create();
|
||||
$this->assertTrue($empty->uuid());
|
||||
$this->assertIdentical($empty->label, NULL);
|
||||
$this->assertIdentical($empty->style, NULL);
|
||||
$this->assertIdentical($empty->language()->getId(), $default_langcode);
|
||||
|
@ -52,11 +52,11 @@ class ConfigEntityTest extends BrowserTestBase {
|
|||
$this->assertIdentical($empty->getOriginalId(), NULL);
|
||||
$this->assertIdentical($empty->bundle(), 'config_test');
|
||||
$this->assertIdentical($empty->id(), NULL);
|
||||
$this->assertTrue($empty->uuid());
|
||||
$this->assertTrue(Uuid::isValid($empty->uuid()));
|
||||
$this->assertIdentical($empty->label(), NULL);
|
||||
|
||||
$this->assertIdentical($empty->get('id'), NULL);
|
||||
$this->assertTrue($empty->get('uuid'));
|
||||
$this->assertTrue(Uuid::isValid($empty->get('uuid')));
|
||||
$this->assertIdentical($empty->get('label'), NULL);
|
||||
$this->assertIdentical($empty->get('style'), NULL);
|
||||
$this->assertIdentical($empty->language()->getId(), $default_langcode);
|
||||
|
@ -100,7 +100,6 @@ class ConfigEntityTest extends BrowserTestBase {
|
|||
'label' => $this->randomString(),
|
||||
'style' => $this->randomMachineName(),
|
||||
]);
|
||||
$this->assertTrue($config_test->uuid());
|
||||
$this->assertNotEqual($config_test->uuid(), $empty->uuid());
|
||||
$this->assertIdentical($config_test->label, $expected['label']);
|
||||
$this->assertIdentical($config_test->style, $expected['style']);
|
||||
|
@ -110,7 +109,7 @@ class ConfigEntityTest extends BrowserTestBase {
|
|||
$this->assertIdentical($config_test->isNew(), TRUE);
|
||||
$this->assertIdentical($config_test->getOriginalId(), $expected['id']);
|
||||
$this->assertIdentical($config_test->id(), $expected['id']);
|
||||
$this->assertTrue($config_test->uuid());
|
||||
$this->assertTrue(Uuid::isValid($config_test->uuid()));
|
||||
$expected['uuid'] = $config_test->uuid();
|
||||
$this->assertIdentical($config_test->label(), $expected['label']);
|
||||
|
||||
|
|
|
@ -151,9 +151,7 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
$this->assertTrue(\Drupal::moduleHandler()->moduleExists('action'), 'Action module installed during import.');
|
||||
$this->assertTrue(\Drupal::moduleHandler()->moduleExists('options'), 'Options module installed during import.');
|
||||
$this->assertTrue(\Drupal::moduleHandler()->moduleExists('text'), 'Text module installed during import.');
|
||||
|
||||
$theme_info = \Drupal::service('theme_handler')->listInfo();
|
||||
$this->assertTrue($theme_info['bartik']->status, 'Bartik theme installed during import.');
|
||||
$this->assertTrue(\Drupal::service('theme_handler')->themeExists('bartik'), 'Bartik theme installed during import.');
|
||||
|
||||
// Ensure installations and uninstallation occur as expected.
|
||||
$installed = \Drupal::state()->get('ConfigImportUITest.core.extension.modules_installed', []);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Drupal\Tests\config\Functional;
|
||||
|
||||
use Drupal\config_test\Entity\ConfigTest;
|
||||
use Drupal\Core\Config\PreExistingConfigException;
|
||||
use Drupal\Core\Config\StorageInterface;
|
||||
use Drupal\Core\File\Exception\FileException;
|
||||
|
@ -197,7 +198,7 @@ class ConfigInstallWebTest extends BrowserTestBase {
|
|||
$this->drupalPostForm('admin/modules', ['modules[config_other_module_config_test][enable]' => TRUE], t('Install'));
|
||||
$this->drupalPostForm('admin/modules', ['modules[config_install_dependency_test][enable]' => TRUE], t('Install'));
|
||||
$this->rebuildContainer();
|
||||
$this->assertTrue(\Drupal::entityTypeManager()->getStorage('config_test')->load('other_module_test_with_dependency'), 'The config_test.dynamic.other_module_test_with_dependency configuration has been created during install.');
|
||||
$this->assertInstanceOf(ConfigTest::class, \Drupal::entityTypeManager()->getStorage('config_test')->load('other_module_test_with_dependency'), 'The config_test.dynamic.other_module_test_with_dependency configuration has been created during install.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ class ConfigOtherModuleTest extends BrowserTestBase {
|
|||
// Install the module that provides the entity type. This installs the
|
||||
// default configuration.
|
||||
$this->installModule('config_test');
|
||||
$this->assertTrue($this->getStorage()->load('other_module_test'), 'Default configuration has been installed.');
|
||||
$this->assertNotEmpty($this->getStorage()->load('other_module_test'), 'Default configuration has been installed.');
|
||||
|
||||
// Uninstall the module that provides the entity type. This will remove the
|
||||
// default configuration.
|
||||
|
@ -43,7 +43,7 @@ class ConfigOtherModuleTest extends BrowserTestBase {
|
|||
// default configuration.
|
||||
$this->installModule('config_test');
|
||||
$other_module_config_entity = $this->getStorage()->load('other_module_test');
|
||||
$this->assertTrue($other_module_config_entity, "Default configuration has been recreated.");
|
||||
$this->assertNotEmpty($other_module_config_entity, "Default configuration has been recreated.");
|
||||
|
||||
// Update the default configuration to test that the changes are preserved
|
||||
// if the module that provides the default configuration is uninstalled.
|
||||
|
@ -52,10 +52,10 @@ class ConfigOtherModuleTest extends BrowserTestBase {
|
|||
|
||||
// Uninstall the module that provides the default configuration.
|
||||
$this->uninstallModule('config_other_module_config_test');
|
||||
$this->assertTrue($this->getStorage()->load('other_module_test'), 'Default configuration for other modules is not removed when the module that provides it is uninstalled.');
|
||||
$this->assertNotEmpty($this->getStorage()->load('other_module_test'), 'Default configuration for other modules is not removed when the module that provides it is uninstalled.');
|
||||
|
||||
// Default configuration provided by config_test should still exist.
|
||||
$this->assertTrue($this->getStorage()->load('dotted.default'), 'The configuration is not deleted.');
|
||||
$this->assertNotEmpty($this->getStorage()->load('dotted.default'), 'The configuration is not deleted.');
|
||||
|
||||
// Re-enable module to test that pre-existing optional configuration does
|
||||
// not throw an error.
|
||||
|
@ -68,12 +68,12 @@ class ConfigOtherModuleTest extends BrowserTestBase {
|
|||
$this->assertNull($this->getStorage()->load('other_module_test_optional_entity_unmet'), 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet whose dependencies are not met is not created.'); $this->installModule('config_test_language');
|
||||
$this->assertNull($this->getStorage()->load('other_module_test_optional_entity_unmet'), 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet whose dependencies are met is not created.');
|
||||
$this->installModule('config_install_dependency_test');
|
||||
$this->assertTrue($this->getStorage()->load('other_module_test_unmet'), 'The optional configuration config_test.dynamic.other_module_test_unmet whose dependencies are met is now created.');
|
||||
$this->assertNotEmpty($this->getStorage()->load('other_module_test_unmet'), 'The optional configuration config_test.dynamic.other_module_test_unmet whose dependencies are met is now created.');
|
||||
// The following configuration entity's dependencies are now met. It is
|
||||
// indirectly dependent on the config_install_dependency_test module because
|
||||
// it has a dependency on the config_test.dynamic.dependency_for_unmet2
|
||||
// configuration provided by that module and, therefore, should be created.
|
||||
$this->assertTrue($this->getStorage()->load('other_module_test_optional_entity_unmet2'), 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet2 whose dependencies are met is now created.');
|
||||
$this->assertNotEmpty($this->getStorage()->load('other_module_test_optional_entity_unmet2'), 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet2 whose dependencies are met is now created.');
|
||||
|
||||
// The following configuration entity's dependencies are now met even though
|
||||
// it has no direct dependency on the module. It is indirectly dependent on
|
||||
|
@ -82,13 +82,13 @@ class ConfigOtherModuleTest extends BrowserTestBase {
|
|||
// dependent on the config_install_dependency_test module and, therefore,
|
||||
// should be created.
|
||||
$entity = $this->getStorage()->load('other_module_test_optional_entity_unmet');
|
||||
$this->assertTrue($entity, 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet whose dependencies are met is created.');
|
||||
$this->assertNotEmpty($entity, 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet whose dependencies are met is created.');
|
||||
$entity->delete();
|
||||
|
||||
// Install another module to ensure the configuration just deleted is not
|
||||
// recreated.
|
||||
$this->installModule('config');
|
||||
$this->assertFalse($this->getStorage()->load('other_module_test_optional_entity_unmet'), 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet whose dependencies are met is not installed when an unrelated module is installed.');
|
||||
$this->assertNull($this->getStorage()->load('other_module_test_optional_entity_unmet'), 'The optional configuration config_test.dynamic.other_module_test_optional_entity_unmet whose dependencies are met is not installed when an unrelated module is installed.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,10 +96,10 @@ class ConfigOtherModuleTest extends BrowserTestBase {
|
|||
*/
|
||||
public function testInstallConfigEntityModuleFirst() {
|
||||
$this->installModule('config_test');
|
||||
$this->assertFalse($this->getStorage()->load('other_module_test'), 'Default configuration provided by config_other_module_config_test does not exist.');
|
||||
$this->assertNull($this->getStorage()->load('other_module_test'), 'Default configuration provided by config_other_module_config_test does not exist.');
|
||||
|
||||
$this->installModule('config_other_module_config_test');
|
||||
$this->assertTrue($this->getStorage()->load('other_module_test'), 'Default configuration provided by config_other_module_config_test has been installed.');
|
||||
$this->assertNotEmpty($this->getStorage()->load('other_module_test'), 'Default configuration provided by config_other_module_config_test has been installed.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1165,10 +1165,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
|
|||
]));
|
||||
// Make sure the text format select is not shown.
|
||||
$select_id = str_replace('value', 'format--2', $id);
|
||||
$select = $this->xpath('//select[@id=:id]', [':id' => $select_id]);
|
||||
return $this->assertFalse($select, new FormattableMarkup('Field @id does not exist.', [
|
||||
'@id' => $id,
|
||||
]));
|
||||
$xpath = $this->assertSession()->buildXPathQuery('//select[@id=:id]', [':id' => $select_id]);
|
||||
$this->assertSession()->elementNotExists('xpath', $xpath);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -215,10 +215,10 @@ class ContactPersonalTest extends BrowserTestBase {
|
|||
// form.
|
||||
$this->drupalGet('user/' . $this->webUser->id() . '/edit');
|
||||
$this->assertNoFieldChecked('edit-contact--2');
|
||||
$this->assertFalse(\Drupal::service('user.data')->get('contact', $this->webUser->id(), 'enabled'), 'Personal contact form disabled');
|
||||
$this->assertNull(\Drupal::service('user.data')->get('contact', $this->webUser->id(), 'enabled'), 'Personal contact form disabled');
|
||||
$this->drupalPostForm(NULL, ['contact' => TRUE], t('Save'));
|
||||
$this->assertFieldChecked('edit-contact--2');
|
||||
$this->assertTrue(\Drupal::service('user.data')->get('contact', $this->webUser->id(), 'enabled'), 'Personal contact form enabled');
|
||||
$this->assertNotEmpty(\Drupal::service('user.data')->get('contact', $this->webUser->id(), 'enabled'), 'Personal contact form enabled');
|
||||
|
||||
// Test with disabled global default contact form in combination with a user
|
||||
// that has the contact form enabled.
|
||||
|
|
|
@ -55,10 +55,10 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
$this->drupalGet('contact');
|
||||
|
||||
// Ensure that there is no textfield for name.
|
||||
$this->assertFalse($this->xpath('//input[@name=:name]', [':name' => 'name']));
|
||||
$this->assertEmpty($this->xpath('//input[@name=:name]', [':name' => 'name']));
|
||||
|
||||
// Ensure that there is no textfield for email.
|
||||
$this->assertFalse($this->xpath('//input[@name=:name]', [':name' => 'mail']));
|
||||
$this->assertEmpty($this->xpath('//input[@name=:name]', [':name' => 'mail']));
|
||||
|
||||
// Logout and retrieve the page as an anonymous user
|
||||
$this->drupalLogout();
|
||||
|
@ -66,10 +66,10 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
$this->drupalGet('contact');
|
||||
|
||||
// Ensure that there is textfield for name.
|
||||
$this->assertTrue($this->xpath('//input[@name=:name]', [':name' => 'name']));
|
||||
$this->assertNotEmpty($this->xpath('//input[@name=:name]', [':name' => 'name']));
|
||||
|
||||
// Ensure that there is textfield for email.
|
||||
$this->assertTrue($this->xpath('//input[@name=:name]', [':name' => 'mail']));
|
||||
$this->assertNotEmpty($this->xpath('//input[@name=:name]', [':name' => 'mail']));
|
||||
|
||||
// Create and log in administrative user.
|
||||
$admin_user = $this->drupalCreateUser([
|
||||
|
@ -329,8 +329,8 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
$mails = $this->getMails();
|
||||
$mail = array_pop($mails);
|
||||
$this->assertEqual($mail['subject'], t('[@label] @subject', ['@label' => $label, '@subject' => $edit['subject[0][value]']]));
|
||||
$this->assertTrue(strpos($mail['body'], $field_label));
|
||||
$this->assertTrue(strpos($mail['body'], $edit[$field_name . '[0][value]']));
|
||||
$this->assertContains($field_label, $mail['body']);
|
||||
$this->assertContains($edit[$field_name . '[0][value]'], $mail['body']);
|
||||
|
||||
// Test messages and redirect.
|
||||
/** @var \Drupal\contact\ContactFormInterface $form */
|
||||
|
@ -573,7 +573,7 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
else {
|
||||
$this->drupalPostForm("admin/structure/contact/manage/$id/delete", [], t('Delete'));
|
||||
$this->assertRaw(t('The contact form %label has been deleted.', ['%label' => $contact_form->label()]));
|
||||
$this->assertFalse(ContactForm::load($id), new FormattableMarkup('Form %contact_form not found', ['%contact_form' => $contact_form->label()]));
|
||||
$this->assertNull(ContactForm::load($id), new FormattableMarkup('Form %contact_form not found', ['%contact_form' => $contact_form->label()]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class ContactUpdateTest extends UpdatePathTestBase {
|
|||
$config_factory = \Drupal::configFactory();
|
||||
// Check that contact_form entities are more than zero.
|
||||
$contact_forms = $config_factory->listAll('contact.form.');
|
||||
$this->assertTrue(count($contact_forms), 'There are contact forms to update.');
|
||||
$this->assertGreaterThan(0, count($contact_forms), 'There are contact forms to update.');
|
||||
foreach ($contact_forms as $contact_config_name) {
|
||||
$contact_form_data = $config_factory->get($contact_config_name)->get();
|
||||
$this->assertFalse(isset($contact_form_data['message']), 'Prior to running the update the "message" key does not exist.');
|
||||
|
|
|
@ -106,7 +106,7 @@ class ContactLinkTest extends ViewTestBase {
|
|||
$account = $accounts[$name];
|
||||
|
||||
$result = $this->xpath('//div[contains(@class, "views-field-contact")]//a[contains(@href, :url)]', [':url' => $account->toUrl('contact-form')->toString()]);
|
||||
$this->assertTrue(count($result));
|
||||
$this->assertGreaterThan(0, count($result));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class ContactFieldsTest extends KernelTestBase {
|
|||
// entities have no storage.
|
||||
$table_name = 'contact_message__' . $field_name;
|
||||
$data = $this->container->get('views.views_data')->get($table_name);
|
||||
$this->assertFalse($data);
|
||||
$this->assertEmpty($data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -301,10 +301,10 @@ class ModerationFormTest extends ModerationStateTestBase {
|
|||
'body[0][value]' => 'First version of the content.',
|
||||
'moderation_state[0][state]' => 'draft',
|
||||
], t('Save'));
|
||||
$this->assertTrue($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
$this->assertNotEmpty($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
|
||||
$node = $this->drupalGetNodeByTitle('Some moderated content');
|
||||
$this->assertTrue($node->language(), 'en');
|
||||
$this->assertNotEmpty($node->language(), 'en');
|
||||
$edit_path = sprintf('node/%d/edit', $node->id());
|
||||
$translate_path = sprintf('node/%d/translations/add/en/fr', $node->id());
|
||||
$latest_version_path = sprintf('node/%d/latest', $node->id());
|
||||
|
@ -312,7 +312,7 @@ class ModerationFormTest extends ModerationStateTestBase {
|
|||
|
||||
$this->drupalGet($latest_version_path);
|
||||
$this->assertSession()->statusCodeEquals('403');
|
||||
$this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
$this->assertEmpty($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
|
||||
// Add french translation (revision 2).
|
||||
$this->drupalGet($translate_path);
|
||||
|
@ -326,7 +326,7 @@ class ModerationFormTest extends ModerationStateTestBase {
|
|||
|
||||
$this->drupalGet($latest_version_path, ['language' => $french]);
|
||||
$this->assertSession()->statusCodeEquals('403');
|
||||
$this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
$this->assertEmpty($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
|
||||
// Add french pending revision (revision 3).
|
||||
$this->drupalGet($edit_path, ['language' => $french]);
|
||||
|
@ -349,14 +349,14 @@ class ModerationFormTest extends ModerationStateTestBase {
|
|||
], t('Save (this translation)'));
|
||||
|
||||
$this->drupalGet($latest_version_path, ['language' => $french]);
|
||||
$this->assertTrue($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
$this->assertNotEmpty($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
|
||||
$this->drupalGet($edit_path);
|
||||
$this->clickLink('Delete');
|
||||
$this->assertSession()->buttonExists('Delete');
|
||||
|
||||
$this->drupalGet($latest_version_path);
|
||||
$this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
$this->assertEmpty($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
|
||||
// Publish the french pending revision (revision 4).
|
||||
$this->drupalGet($edit_path, ['language' => $french]);
|
||||
|
@ -369,7 +369,7 @@ class ModerationFormTest extends ModerationStateTestBase {
|
|||
], t('Save (this translation)'));
|
||||
|
||||
$this->drupalGet($latest_version_path, ['language' => $french]);
|
||||
$this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
$this->assertEmpty($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
|
||||
// Publish the English pending revision (revision 5).
|
||||
$this->drupalGet($edit_path);
|
||||
|
@ -382,7 +382,7 @@ class ModerationFormTest extends ModerationStateTestBase {
|
|||
], t('Save (this translation)'));
|
||||
|
||||
$this->drupalGet($latest_version_path);
|
||||
$this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
$this->assertEmpty($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
|
||||
// Make sure we are allowed to create a pending French revision.
|
||||
$this->drupalGet($edit_path, ['language' => $french]);
|
||||
|
@ -401,9 +401,9 @@ class ModerationFormTest extends ModerationStateTestBase {
|
|||
], t('Save (this translation)'));
|
||||
|
||||
$this->drupalGet($latest_version_path);
|
||||
$this->assertTrue($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
$this->assertNotEmpty($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
$this->drupalGet($latest_version_path, ['language' => $french]);
|
||||
$this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
$this->assertEmpty($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
|
||||
// Publish the English pending revision (revision 7)
|
||||
$this->drupalGet($edit_path);
|
||||
|
@ -416,7 +416,7 @@ class ModerationFormTest extends ModerationStateTestBase {
|
|||
], t('Save (this translation)'));
|
||||
|
||||
$this->drupalGet($latest_version_path);
|
||||
$this->assertFalse($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
$this->assertEmpty($this->xpath('//ul[@class="entity-moderation-form"]'));
|
||||
|
||||
// Make sure we are allowed to create a pending French revision.
|
||||
$this->drupalGet($edit_path, ['language' => $french]);
|
||||
|
@ -437,7 +437,7 @@ class ModerationFormTest extends ModerationStateTestBase {
|
|||
], t('Save'));
|
||||
|
||||
$node = $this->drupalGetNodeByTitle('Third moderated content');
|
||||
$this->assertTrue($node->language(), 'en');
|
||||
$this->assertNotEmpty($node->language(), 'en');
|
||||
$edit_path = sprintf('node/%d/edit', $node->id());
|
||||
$translate_path = sprintf('node/%d/translations/add/en/fr', $node->id());
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ class ContentModerationStateTest extends KernelTestBase {
|
|||
$entity = $this->reloadEntity($entity);
|
||||
$entity->delete();
|
||||
$content_moderation_state = ContentModerationState::loadFromModeratedEntity($entity);
|
||||
$this->assertFalse($content_moderation_state);
|
||||
$this->assertNull($content_moderation_state);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -233,13 +233,13 @@ class ContentModerationStateTest extends KernelTestBase {
|
|||
$entity->save();
|
||||
|
||||
$content_moderation_state = ContentModerationState::loadFromModeratedEntity($entity);
|
||||
$this->assertTrue($content_moderation_state);
|
||||
$this->assertNotEmpty($content_moderation_state);
|
||||
|
||||
$entity_storage = $this->entityTypeManager->getStorage($entity_type_id);
|
||||
$entity_storage->deleteRevision($entity->getRevisionId());
|
||||
|
||||
$content_moderation_state = ContentModerationState::loadFromModeratedEntity($entity);
|
||||
$this->assertFalse($content_moderation_state);
|
||||
$this->assertNull($content_moderation_state);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -136,7 +136,7 @@ class ContentTranslationLinkTagTest extends BrowserTestBase {
|
|||
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$result = $this->xpath('//link[@rel="alternate" and @hreflang]');
|
||||
$this->assertFalse($result, 'No alternate link tag found.');
|
||||
$this->assertEmpty($result, 'No alternate link tag found.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
|
|||
];
|
||||
$this->assertSettings('comment', 'comment_article', FALSE, $edit);
|
||||
$xpath_err = '//div[contains(@class, "error")]';
|
||||
$this->assertTrue($this->xpath($xpath_err), 'Enabling translation only for entity bundles generates a form error.');
|
||||
$this->assertNotEmpty($this->xpath($xpath_err), 'Enabling translation only for entity bundles generates a form error.');
|
||||
|
||||
// Test that the translation settings are not stored if a non-configurable
|
||||
// language is set as default and the language selector is hidden.
|
||||
|
@ -94,7 +94,7 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
|
|||
'settings[comment][comment_article][fields][comment_body]' => TRUE,
|
||||
];
|
||||
$this->assertSettings('comment', 'comment_article', FALSE, $edit);
|
||||
$this->assertTrue($this->xpath($xpath_err), 'Enabling translation with a fixed non-configurable language generates a form error.');
|
||||
$this->assertNotEmpty($this->xpath($xpath_err), 'Enabling translation with a fixed non-configurable language generates a form error.');
|
||||
|
||||
// Test that a field shared among different bundles can be enabled without
|
||||
// needing to make all the related bundles translatable.
|
||||
|
|
|
@ -117,7 +117,7 @@ class ContentTranslationSyncImageTest extends ContentTranslationTestBase {
|
|||
];
|
||||
$this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration'));
|
||||
$errors = $this->xpath('//div[contains(@class, "messages--error")]');
|
||||
$this->assertFalse($errors, 'Settings correctly stored.');
|
||||
$this->assertEmpty($errors, 'Settings correctly stored.');
|
||||
$this->assertFieldChecked('edit-settings-entity-test-mul-entity-test-mul-columns-field-test-et-ui-image-alt');
|
||||
$this->assertFieldChecked('edit-settings-entity-test-mul-entity-test-mul-columns-field-test-et-ui-image-title');
|
||||
$this->drupalLogin($this->translator);
|
||||
|
|
|
@ -81,7 +81,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
|
|||
->getStorage($this->entityTypeId);
|
||||
$storage->resetCache([$this->entityId]);
|
||||
$entity = $storage->load($this->entityId);
|
||||
$this->assertTrue($entity, 'Entity found in the database.');
|
||||
$this->assertNotEmpty($entity, 'Entity found in the database.');
|
||||
$this->drupalGet($entity->toUrl());
|
||||
$this->assertResponse(200, 'Entity URL is valid.');
|
||||
|
||||
|
@ -257,11 +257,11 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
|
|||
$this->drupalGet($url);
|
||||
if ($added_langcode == $langcode) {
|
||||
$this->assertFieldByXPath('//input[@name="content_translation[retranslate]"]', FALSE, 'The retranslate flag is not checked by default.');
|
||||
$this->assertFalse($this->xpath('//details[@id="edit-content-translation" and @open="open"]'), 'The translation tab should be collapsed by default.');
|
||||
$this->assertEmpty($this->xpath('//details[@id="edit-content-translation" and @open="open"]'), 'The translation tab should be collapsed by default.');
|
||||
}
|
||||
else {
|
||||
$this->assertFieldByXPath('//input[@name="content_translation[outdated]"]', TRUE, 'The translate flag is checked by default.');
|
||||
$this->assertTrue($this->xpath('//details[@id="edit-content-translation" and @open="open"]'), 'The translation tab is correctly expanded when the translation is outdated.');
|
||||
$this->assertNotEmpty($this->xpath('//details[@id="edit-content-translation" and @open="open"]'), 'The translation tab is correctly expanded when the translation is outdated.');
|
||||
$edit = ['content_translation[outdated]' => FALSE];
|
||||
$this->drupalPostForm($url, $edit, $this->getFormSubmitAction($entity, $added_langcode));
|
||||
$this->drupalGet($url);
|
||||
|
@ -346,7 +346,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
|
|||
'content_translation[created]' => '19/11/1978',
|
||||
];
|
||||
$this->drupalPostForm($entity->toUrl('edit-form'), $edit, $this->getFormSubmitAction($entity, $langcode));
|
||||
$this->assertTrue($this->xpath('//div[contains(@class, "error")]//ul'), 'Invalid values generate a list of form errors.');
|
||||
$this->assertNotEmpty($this->xpath('//div[contains(@class, "error")]//ul'), 'Invalid values generate a list of form errors.');
|
||||
$metadata = $this->manager->getTranslationMetadata($entity->getTranslation($langcode));
|
||||
$this->assertEqual($metadata->getAuthor()->id(), $values[$langcode]['uid'], 'Translation author correctly kept.');
|
||||
$this->assertEqual($metadata->getCreatedTime(), $values[$langcode]['created'], 'Translation date correctly kept.');
|
||||
|
|
|
@ -187,7 +187,7 @@ class DbLogTest extends BrowserTestBase {
|
|||
|
||||
// Check row limit variable.
|
||||
$current_limit = $this->config('dblog.settings')->get('row_limit');
|
||||
$this->assertTrue($current_limit == $row_limit, new FormattableMarkup('[Cache] Row limit variable of @count equals row limit of @limit', ['@count' => $current_limit, '@limit' => $row_limit]));
|
||||
$this->assertEquals($current_limit, $row_limit, new FormattableMarkup('[Cache] Row limit variable of @count equals row limit of @limit', ['@count' => $current_limit, '@limit' => $row_limit]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -346,7 +346,7 @@ class DbLogTest extends BrowserTestBase {
|
|||
$this->assertResponse(200);
|
||||
// Retrieve the user object.
|
||||
$user = user_load_by_name($name);
|
||||
$this->assertTrue($user != NULL, new FormattableMarkup('User @name was loaded', ['@name' => $name]));
|
||||
$this->assertNotNull($user, new FormattableMarkup('User @name was loaded', ['@name' => $name]));
|
||||
// pass_raw property is needed by drupalLogin.
|
||||
$user->passRaw = $pass;
|
||||
// Log in user.
|
||||
|
@ -359,7 +359,7 @@ class DbLogTest extends BrowserTestBase {
|
|||
$ids[] = $row->wid;
|
||||
}
|
||||
$count_before = (isset($ids)) ? count($ids) : 0;
|
||||
$this->assertTrue($count_before > 0, new FormattableMarkup('DBLog contains @count records for @name', ['@count' => $count_before, '@name' => $user->getAccountName()]));
|
||||
$this->assertGreaterThan(0, $count_before, new FormattableMarkup('DBLog contains @count records for @name', ['@count' => $count_before, '@name' => $user->getAccountName()]));
|
||||
|
||||
// Log in the admin user.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
@ -396,7 +396,7 @@ class DbLogTest extends BrowserTestBase {
|
|||
// Check for full message text on the details page.
|
||||
$this->assertRaw($message, 'DBLog event details was found: [delete user]');
|
||||
}
|
||||
$this->assertTrue($link, 'DBLog event was recorded: [delete user]');
|
||||
$this->assertNotEmpty($link, 'DBLog event was recorded: [delete user]');
|
||||
// Visit random URL (to generate page not found event).
|
||||
$not_found_url = $this->randomMachineName(60);
|
||||
$this->drupalGet($not_found_url);
|
||||
|
@ -429,7 +429,7 @@ class DbLogTest extends BrowserTestBase {
|
|||
$this->assertResponse(200);
|
||||
// Retrieve the node object.
|
||||
$node = $this->drupalGetNodeByTitle($title);
|
||||
$this->assertTrue($node != NULL, new FormattableMarkup('Node @title was loaded', ['@title' => $title]));
|
||||
$this->assertNotNull($node, new FormattableMarkup('Node @title was loaded', ['@title' => $title]));
|
||||
// Edit the node.
|
||||
$edit = $this->getContentUpdate($type);
|
||||
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
|
||||
|
|
|
@ -40,7 +40,7 @@ class ConnectionFailureTest extends KernelTestBase {
|
|||
$database = Database::getConnection();
|
||||
|
||||
$wid = $database->query("SELECT MAX(wid) FROM {watchdog} WHERE message = 'testConnectionFailureLogging'")->fetchField();
|
||||
$this->assertTrue($wid);
|
||||
$this->assertNotEmpty($wid, 'Watchdog entry has been stored in database.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class DynamicPageCacheIntegrationTest extends BrowserTestBase {
|
|||
// Cache.
|
||||
$url = Url::fromUri('route:dynamic_page_cache_test.response');
|
||||
$this->drupalGet($url);
|
||||
$this->assertFalse($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Response object returned: Dynamic Page Cache is ignoring.');
|
||||
$this->assertNull($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Response object returned: Dynamic Page Cache is ignoring.');
|
||||
|
||||
// Controllers returning CacheableResponseInterface (cacheable response)
|
||||
// objects are handled by Dynamic Page Cache.
|
||||
|
@ -100,19 +100,19 @@ class DynamicPageCacheIntegrationTest extends BrowserTestBase {
|
|||
// response, are ignored by Dynamic Page Cache (but only because those
|
||||
// wrapper formats' responses do not implement CacheableResponseInterface).
|
||||
$this->drupalGet('dynamic-page-cache-test/html', ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]);
|
||||
$this->assertFalse($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Render array returned, rendered as AJAX response: Dynamic Page Cache is ignoring.');
|
||||
$this->assertNull($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Render array returned, rendered as AJAX response: Dynamic Page Cache is ignoring.');
|
||||
$this->drupalGet('dynamic-page-cache-test/html', ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_dialog']]);
|
||||
$this->assertFalse($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Render array returned, rendered as dialog response: Dynamic Page Cache is ignoring.');
|
||||
$this->assertNull($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Render array returned, rendered as dialog response: Dynamic Page Cache is ignoring.');
|
||||
$this->drupalGet('dynamic-page-cache-test/html', ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_modal']]);
|
||||
$this->assertFalse($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Render array returned, rendered as modal response: Dynamic Page Cache is ignoring.');
|
||||
$this->assertNull($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Render array returned, rendered as modal response: Dynamic Page Cache is ignoring.');
|
||||
|
||||
// Admin routes are ignored by Dynamic Page Cache.
|
||||
$this->drupalGet('dynamic-page-cache-test/html/admin');
|
||||
$this->assertFalse($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Response returned, rendered as HTML response, admin route: Dynamic Page Cache is ignoring');
|
||||
$this->assertNull($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Response returned, rendered as HTML response, admin route: Dynamic Page Cache is ignoring');
|
||||
$this->drupalGet('dynamic-page-cache-test/response/admin');
|
||||
$this->assertFalse($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Response returned, plain response, admin route: Dynamic Page Cache is ignoring');
|
||||
$this->assertNull($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Response returned, plain response, admin route: Dynamic Page Cache is ignoring');
|
||||
$this->drupalGet('dynamic-page-cache-test/cacheable-response/admin');
|
||||
$this->assertFalse($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Response returned, cacheable response, admin route: Dynamic Page Cache is ignoring');
|
||||
$this->assertNull($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Response returned, cacheable response, admin route: Dynamic Page Cache is ignoring');
|
||||
|
||||
// Max-age = 0 responses are ignored by Dynamic Page Cache.
|
||||
$this->drupalGet('dynamic-page-cache-test/html/uncacheable/max-age');
|
||||
|
|
|
@ -211,7 +211,7 @@ class EditorAdminTest extends BrowserTestBase {
|
|||
];
|
||||
$this->drupalPostForm(NULL, $edit, 'Configure');
|
||||
$unicorn_setting = $this->xpath('//input[@name="editor[settings][ponies_too]" and @type="checkbox" and @checked]');
|
||||
$this->assertTrue(count($unicorn_setting), "Unicorn Editor's settings form is present.");
|
||||
$this->assertCount(1, $unicorn_setting, "Unicorn Editor's settings form is present.");
|
||||
|
||||
return $edit;
|
||||
}
|
||||
|
|
|
@ -70,8 +70,8 @@ class EditorDialogAccessTest extends BrowserTestBase {
|
|||
$editor->save();
|
||||
$this->resetAll();
|
||||
$this->drupalGet($url);
|
||||
$this->assertTrue($this->cssSelect('input[type=text][name="attributes[src]"]'), 'Image uploads disabled: input[type=text][name="attributes[src]"] is present.');
|
||||
$this->assertFalse($this->cssSelect('input[type=file]'), 'Image uploads disabled: input[type=file] is absent.');
|
||||
$this->assertNotEmpty($this->cssSelect('input[type=text][name="attributes[src]"]'), 'Image uploads disabled: input[type=text][name="attributes[src]"] is present.');
|
||||
$this->assertEmpty($this->cssSelect('input[type=file]'), 'Image uploads disabled: input[type=file] is absent.');
|
||||
$session->statusCodeEquals(200);
|
||||
|
||||
// With image upload settings, expect a 200, and now there should be an
|
||||
|
@ -80,8 +80,8 @@ class EditorDialogAccessTest extends BrowserTestBase {
|
|||
->save();
|
||||
$this->resetAll();
|
||||
$this->drupalGet($url);
|
||||
$this->assertFalse($this->cssSelect('input[type=text][name="attributes[src]"]'), 'Image uploads enabled: input[type=text][name="attributes[src]"] is absent.');
|
||||
$this->assertTrue($this->cssSelect('input[type=file]'), 'Image uploads enabled: input[type=file] is present.');
|
||||
$this->assertEmpty($this->cssSelect('input[type=text][name="attributes[src]"]'), 'Image uploads enabled: input[type=text][name="attributes[src]"] is absent.');
|
||||
$this->assertNotEmpty($this->cssSelect('input[type=file]'), 'Image uploads enabled: input[type=file] is present.');
|
||||
$session->statusCodeEquals(200);
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ class EntityReferenceAutoCreateTest extends BrowserTestBase {
|
|||
|
||||
$query = clone $base_query;
|
||||
$result = $query->execute();
|
||||
$this->assertFalse($result, 'Referenced node does not exist yet.');
|
||||
$this->assertEmpty($result, 'Referenced node does not exist yet.');
|
||||
|
||||
$edit = [
|
||||
'title[0][value]' => $this->randomMachineName(),
|
||||
|
@ -125,7 +125,7 @@ class EntityReferenceAutoCreateTest extends BrowserTestBase {
|
|||
// Assert referenced node was created.
|
||||
$query = clone $base_query;
|
||||
$result = $query->execute();
|
||||
$this->assertTrue($result, 'Referenced node was created.');
|
||||
$this->assertNotEmpty($result, 'Referenced node was created.');
|
||||
$referenced_nid = key($result);
|
||||
$referenced_node = Node::load($referenced_nid);
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ class EntityReferenceIntegrationTest extends BrowserTestBase {
|
|||
$entity = current($this->container->get('entity_type.manager')->getStorage(
|
||||
$this->entityType)->loadByProperties(['name' => $entity_name]));
|
||||
|
||||
$this->assertTrue($entity, new FormattableMarkup('%entity_type: Entity found in the database.', ['%entity_type' => $this->entityType]));
|
||||
$this->assertNotEmpty($entity, new FormattableMarkup('%entity_type: Entity found in the database.', ['%entity_type' => $this->entityType]));
|
||||
|
||||
$this->assertEqual($entity->{$this->fieldName}->target_id, $referenced_entities[0]->id());
|
||||
$this->assertEqual($entity->{$this->fieldName}->entity->id(), $referenced_entities[0]->id());
|
||||
|
|
|
@ -114,7 +114,7 @@ class FieldImportDeleteUninstallUiTest extends FieldTestBase {
|
|||
$this->assertNoText('Field data will be deleted by this synchronization.');
|
||||
$this->rebuildContainer();
|
||||
$this->assertFalse(\Drupal::moduleHandler()->moduleExists('telephone'));
|
||||
$this->assertFalse(\Drupal::service('entity.repository')->loadEntityByUuid('field_storage_config', $field_storage->uuid()), 'The telephone field has been deleted by the configuration synchronization');
|
||||
$this->assertNull(\Drupal::service('entity.repository')->loadEntityByUuid('field_storage_config', $field_storage->uuid()), 'The telephone field has been deleted by the configuration synchronization');
|
||||
$deleted_storages = \Drupal::state()->get('field.storage.deleted') ?: [];
|
||||
$this->assertFalse(isset($deleted_storages[$field_storage->uuid()]), 'Telephone field has been completed removed from the system.');
|
||||
$this->assertFalse(isset($deleted_storages[$field_storage->uuid()]), 'Text field has been completed removed from the system.');
|
||||
|
|
|
@ -127,14 +127,14 @@ class NestedFormTest extends FieldTestBase {
|
|||
$this->drupalPostForm('test-entity/nested/1/2', $edit, t('Save'));
|
||||
$this->assertRaw(t('%label does not accept the value -1', ['%label' => 'Unlimited field']), 'Entity 1: the field validation error was reported.');
|
||||
$error_field = $this->xpath('//input[@id=:id and contains(@class, "error")]', [':id' => 'edit-field-unlimited-1-value']);
|
||||
$this->assertTrue($error_field, 'Entity 1: the error was flagged on the correct element.');
|
||||
$this->assertCount(1, $error_field, 'Entity 1: the error was flagged on the correct element.');
|
||||
$edit = [
|
||||
'entity_2[field_unlimited][1][value]' => -1,
|
||||
];
|
||||
$this->drupalPostForm('test-entity/nested/1/2', $edit, t('Save'));
|
||||
$this->assertRaw(t('%label does not accept the value -1', ['%label' => 'Unlimited field']), 'Entity 2: the field validation error was reported.');
|
||||
$error_field = $this->xpath('//input[@id=:id and contains(@class, "error")]', [':id' => 'edit-entity-2-field-unlimited-1-value']);
|
||||
$this->assertTrue($error_field, 'Entity 2: the error was flagged on the correct element.');
|
||||
$this->assertCount(1, $error_field, 'Entity 2: the error was flagged on the correct element.');
|
||||
|
||||
// Test that reordering works on both entities.
|
||||
$edit = [
|
||||
|
|
|
@ -200,7 +200,7 @@ class BulkDeleteTest extends FieldKernelTestBase {
|
|||
->condition('type', $bundle)
|
||||
->condition("$field_name.deleted", 0)
|
||||
->execute();
|
||||
$this->assertFalse($found, 'No entities found after deleting');
|
||||
$this->assertEmpty($found, 'No entities found after deleting');
|
||||
|
||||
// There are 10 entities of this bundle when deleted fields are allowed, and
|
||||
// their values are correct.
|
||||
|
@ -210,8 +210,8 @@ class BulkDeleteTest extends FieldKernelTestBase {
|
|||
->condition("$field_name.deleted", 1)
|
||||
->sort('id')
|
||||
->execute();
|
||||
$this->assertEqual(count($found), 10, 'Correct number of entities found after deleting');
|
||||
$this->assertFalse(array_diff($found, array_keys($this->entities)));
|
||||
$this->assertCount(10, $found, 'Correct number of entities found after deleting');
|
||||
$this->assertEmpty(array_diff($found, array_keys($this->entities)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -278,9 +278,9 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
|
|||
$controller->resetCache();
|
||||
foreach ([0, 1, 2] as $vid) {
|
||||
$revision = $controller->loadRevision($vid);
|
||||
$this->assertFalse($revision);
|
||||
$this->assertNull($revision);
|
||||
}
|
||||
$this->assertFalse($controller->load($entity->id()));
|
||||
$this->assertNull($controller->load($entity->id()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -370,8 +370,8 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
|
|||
$this->assertTrue(empty($entity->{$field_name}), 'No data for second field');
|
||||
|
||||
// Verify that the fields are gone.
|
||||
$this->assertFalse(FieldConfig::load('entity_test.' . $this->fieldTestData->field->getTargetBundle() . '.' . $this->fieldTestData->field_name), "First field is deleted");
|
||||
$this->assertFalse(FieldConfig::load('entity_test.' . $field['bundle'] . '.' . $field_name), "Second field is deleted");
|
||||
$this->assertNull(FieldConfig::load('entity_test.' . $this->fieldTestData->field->getTargetBundle() . '.' . $this->fieldTestData->field_name), "First field is deleted");
|
||||
$this->assertNull(FieldConfig::load('entity_test.' . $field['bundle'] . '.' . $field_name), "Second field is deleted");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ class FieldCrudTest extends FieldKernelTestBase {
|
|||
$field->save();
|
||||
|
||||
$field = FieldConfig::load($field->id());
|
||||
$this->assertTrue($field->getSetting('field_setting_from_config_data'));
|
||||
$this->assertEquals('TRUE', $field->getSetting('field_setting_from_config_data'));
|
||||
$this->assertNull($field->getSetting('config_data_from_field_setting'));
|
||||
|
||||
// Read the configuration. Check against raw configuration data rather than
|
||||
|
@ -314,8 +314,8 @@ class FieldCrudTest extends FieldKernelTestBase {
|
|||
FieldConfig::create($this->fieldDefinition)->save();
|
||||
FieldConfig::create($field_definition_2)->save();
|
||||
$field_storage->delete();
|
||||
$this->assertFalse(FieldConfig::loadByName('entity_test', $this->fieldDefinition['bundle'], $field_storage->getName()));
|
||||
$this->assertFalse(FieldConfig::loadByName('entity_test', $field_definition_2['bundle'], $field_storage->getName()));
|
||||
$this->assertNull(FieldConfig::loadByName('entity_test', $this->fieldDefinition['bundle'], $field_storage->getName()));
|
||||
$this->assertNull(FieldConfig::loadByName('entity_test', $field_definition_2['bundle'], $field_storage->getName()));
|
||||
|
||||
// Check that deletion of the last field deletes the storage.
|
||||
$field_storage = FieldStorageConfig::create($this->fieldStorageDefinition);
|
||||
|
@ -325,9 +325,9 @@ class FieldCrudTest extends FieldKernelTestBase {
|
|||
$field_2 = FieldConfig::create($field_definition_2);
|
||||
$field_2->save();
|
||||
$field->delete();
|
||||
$this->assertTrue(FieldStorageConfig::loadByName('entity_test', $field_storage->getName()));
|
||||
$this->assertNotEmpty(FieldStorageConfig::loadByName('entity_test', $field_storage->getName()));
|
||||
$field_2->delete();
|
||||
$this->assertFalse(FieldStorageConfig::loadByName('entity_test', $field_storage->getName()));
|
||||
$this->assertNull(FieldStorageConfig::loadByName('entity_test', $field_storage->getName()));
|
||||
|
||||
// Check that deletion of all fields using a storage simultaneously deletes
|
||||
// the storage.
|
||||
|
@ -338,7 +338,7 @@ class FieldCrudTest extends FieldKernelTestBase {
|
|||
$field_2 = FieldConfig::create($field_definition_2);
|
||||
$field_2->save();
|
||||
$this->container->get('entity_type.manager')->getStorage('field_config')->delete([$field, $field_2]);
|
||||
$this->assertFalse(FieldStorageConfig::loadByName('entity_test', $field_storage->getName()));
|
||||
$this->assertNull(FieldStorageConfig::loadByName('entity_test', $field_storage->getName()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,11 +26,11 @@ class FieldImportCreateTest extends FieldKernelTestBase {
|
|||
$field_id_2b = "entity_test.test_bundle.$field_name_2";
|
||||
|
||||
// Check that the field storages and fields do not exist yet.
|
||||
$this->assertFalse(FieldStorageConfig::load($field_storage_id));
|
||||
$this->assertFalse(FieldConfig::load($field_id));
|
||||
$this->assertFalse(FieldStorageConfig::load($field_storage_id_2));
|
||||
$this->assertFalse(FieldConfig::load($field_id_2a));
|
||||
$this->assertFalse(FieldConfig::load($field_id_2b));
|
||||
$this->assertNull(FieldStorageConfig::load($field_storage_id));
|
||||
$this->assertNull(FieldConfig::load($field_id));
|
||||
$this->assertNull(FieldStorageConfig::load($field_storage_id_2));
|
||||
$this->assertNull(FieldConfig::load($field_id_2a));
|
||||
$this->assertNull(FieldConfig::load($field_id_2b));
|
||||
|
||||
// Create a second bundle for the 'Entity test' entity type.
|
||||
entity_test_create_bundle('test_bundle');
|
||||
|
@ -41,15 +41,17 @@ class FieldImportCreateTest extends FieldKernelTestBase {
|
|||
|
||||
// A field storage with one single field.
|
||||
$field_storage = FieldStorageConfig::load($field_storage_id);
|
||||
$this->assertTrue($field_storage, 'The field was created.');
|
||||
$this->assertNotEmpty($field_storage, 'The field was created.');
|
||||
$field = FieldConfig::load($field_id);
|
||||
$this->assertTrue($field, 'The field was deleted.');
|
||||
$this->assertNotEmpty($field, 'The field was deleted.');
|
||||
|
||||
// A field storage with two fields.
|
||||
$field_storage_2 = FieldStorageConfig::load($field_storage_id_2);
|
||||
$this->assertTrue($field_storage_2, 'The second field was created.');
|
||||
$this->assertTrue($field->getTargetBundle(), 'test_bundle', 'The second field was created on bundle test_bundle.');
|
||||
$this->assertTrue($field->getTargetBundle(), 'test_bundle_2', 'The second field was created on bundle test_bundle_2.');
|
||||
$this->assertNotEmpty($field_storage_2, 'The second field was created.');
|
||||
$field2a = FieldConfig::load($field_id_2a);
|
||||
$this->assertEquals('entity_test', $field2a->getTargetBundle(), 'The second field was created on bundle entity_test.');
|
||||
$field2b = FieldConfig::load($field_id_2b);
|
||||
$this->assertEquals('test_bundle', $field2b->getTargetBundle(), 'The second field was created on bundle test_bundle.');
|
||||
|
||||
// Tests fields.
|
||||
$ids = \Drupal::entityQuery('field_config')
|
||||
|
@ -96,26 +98,26 @@ class FieldImportCreateTest extends FieldKernelTestBase {
|
|||
$target_dir = Settings::get('config_sync_directory');
|
||||
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
|
||||
$file_system = \Drupal::service('file_system');
|
||||
$this->assertTrue($file_system->copy("$src_dir/$field_storage_config_name.yml", "$target_dir/$field_storage_config_name.yml"));
|
||||
$this->assertTrue($file_system->copy("$src_dir/$field_config_name.yml", "$target_dir/$field_config_name.yml"));
|
||||
$this->assertTrue($file_system->copy("$src_dir/$field_storage_config_name_2.yml", "$target_dir/$field_storage_config_name_2.yml"));
|
||||
$this->assertTrue($file_system->copy("$src_dir/$field_config_name_2a.yml", "$target_dir/$field_config_name_2a.yml"));
|
||||
$this->assertTrue($file_system->copy("$src_dir/$field_config_name_2b.yml", "$target_dir/$field_config_name_2b.yml"));
|
||||
$this->assertNotFalse($file_system->copy("$src_dir/$field_storage_config_name.yml", "$target_dir/$field_storage_config_name.yml"));
|
||||
$this->assertNotFalse($file_system->copy("$src_dir/$field_config_name.yml", "$target_dir/$field_config_name.yml"));
|
||||
$this->assertNotFalse($file_system->copy("$src_dir/$field_storage_config_name_2.yml", "$target_dir/$field_storage_config_name_2.yml"));
|
||||
$this->assertNotFalse($file_system->copy("$src_dir/$field_config_name_2a.yml", "$target_dir/$field_config_name_2a.yml"));
|
||||
$this->assertNotFalse($file_system->copy("$src_dir/$field_config_name_2b.yml", "$target_dir/$field_config_name_2b.yml"));
|
||||
|
||||
// Import the content of the sync directory.
|
||||
$this->configImporter()->import();
|
||||
|
||||
// Check that the field and storage were created.
|
||||
$field_storage = FieldStorageConfig::load($field_storage_id);
|
||||
$this->assertTrue($field_storage, 'Test import storage field from sync exists');
|
||||
$this->assertNotEmpty($field_storage, 'Test import storage field from sync exists');
|
||||
$field = FieldConfig::load($field_id);
|
||||
$this->assertTrue($field, 'Test import field from sync exists');
|
||||
$this->assertNotEmpty($field, 'Test import field from sync exists');
|
||||
$field_storage = FieldStorageConfig::load($field_storage_id_2);
|
||||
$this->assertTrue($field_storage, 'Test import storage field 2 from sync exists');
|
||||
$this->assertNotEmpty($field_storage, 'Test import storage field 2 from sync exists');
|
||||
$field = FieldConfig::load($field_id_2a);
|
||||
$this->assertTrue($field, 'Test import field 2a from sync exists');
|
||||
$this->assertNotEmpty($field, 'Test import field 2a from sync exists');
|
||||
$field = FieldConfig::load($field_id_2b);
|
||||
$this->assertTrue($field, 'Test import field 2b from sync exists');
|
||||
$this->assertNotEmpty($field, 'Test import field 2b from sync exists');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -84,19 +84,19 @@ class FieldImportDeleteTest extends FieldKernelTestBase {
|
|||
// Check that the field storages and fields are gone.
|
||||
\Drupal::entityTypeManager()->getStorage('field_storage_config')->resetCache([$field_storage_id]);
|
||||
$field_storage = FieldStorageConfig::load($field_storage_id);
|
||||
$this->assertFalse($field_storage, 'The field storage was deleted.');
|
||||
$this->assertNull($field_storage, 'The field storage was deleted.');
|
||||
\Drupal::entityTypeManager()->getStorage('field_storage_config')->resetCache([$field_storage_id_2]);
|
||||
$field_storage_2 = FieldStorageConfig::load($field_storage_id_2);
|
||||
$this->assertFalse($field_storage_2, 'The second field storage was deleted.');
|
||||
$this->assertNull($field_storage_2, 'The second field storage was deleted.');
|
||||
\Drupal::entityTypeManager()->getStorage('field_config')->resetCache([$field_id]);
|
||||
$field = FieldConfig::load($field_id);
|
||||
$this->assertFalse($field, 'The field was deleted.');
|
||||
$this->assertNull($field, 'The field was deleted.');
|
||||
\Drupal::entityTypeManager()->getStorage('field_config')->resetCache([$field_id_2a]);
|
||||
$field_2a = FieldConfig::load($field_id_2a);
|
||||
$this->assertFalse($field_2a, 'The second field on test bundle was deleted.');
|
||||
$this->assertNull($field_2a, 'The second field on test bundle was deleted.');
|
||||
\Drupal::entityTypeManager()->getStorage('field_config')->resetCache([$field_id_2b]);
|
||||
$field_2b = FieldConfig::load($field_id_2b);
|
||||
$this->assertFalse($field_2b, 'The second field on test bundle 2 was deleted.');
|
||||
$this->assertNull($field_2b, 'The second field on test bundle 2 was deleted.');
|
||||
|
||||
// Check that all config files are gone.
|
||||
$active = $this->container->get('config.storage');
|
||||
|
|
|
@ -100,7 +100,7 @@ class FieldImportDeleteUninstallTest extends FieldKernelTestBase {
|
|||
$this->configImporter()->import();
|
||||
|
||||
$this->assertFalse(\Drupal::moduleHandler()->moduleExists('telephone'));
|
||||
$this->assertFalse(\Drupal::service('entity.repository')->loadEntityByUuid('field_storage_config', $field_storage->uuid()), 'The test field has been deleted by the configuration synchronization');
|
||||
$this->assertNull(\Drupal::service('entity.repository')->loadEntityByUuid('field_storage_config', $field_storage->uuid()), 'The test field has been deleted by the configuration synchronization');
|
||||
$deleted_storages = \Drupal::state()->get('field.storage.deleted') ?: [];
|
||||
$this->assertFalse(isset($deleted_storages[$field_storage->uuid()]), 'Telephone field has been completed removed from the system.');
|
||||
$this->assertTrue(isset($deleted_storages[$unrelated_field_storage->uuid()]), 'Unrelated field not purged by configuration synchronization.');
|
||||
|
|
|
@ -42,7 +42,7 @@ class FieldStorageCrudTest extends FieldKernelTestBase {
|
|||
$field_storage->save();
|
||||
|
||||
$field_storage = FieldStorageConfig::load($field_storage->id());
|
||||
$this->assertTrue($field_storage->getSetting('storage_setting_from_config_data'));
|
||||
$this->assertEquals('TRUE', $field_storage->getSetting('storage_setting_from_config_data'));
|
||||
$this->assertNull($field_storage->getSetting('config_data_from_storage_setting'));
|
||||
|
||||
$mem = field_test_memorize();
|
||||
|
|
|
@ -64,7 +64,7 @@ class MigrateFieldWidgetSettingsTest extends MigrateDrupal6TestBase {
|
|||
$component = $form_display->getComponent('field_test_link');
|
||||
$this->assertIdentical('link_default', $component['type']);
|
||||
$this->assertIdentical(7, $component['weight']);
|
||||
$this->assertFalse(array_filter($component['settings']));
|
||||
$this->assertEmpty(array_filter($component['settings']));
|
||||
|
||||
// File field.
|
||||
$component = $form_display->getComponent('field_test_filefield');
|
||||
|
|
|
@ -43,7 +43,7 @@ class UuidFormatterTest extends KernelTestBase {
|
|||
// Verify default render.
|
||||
$render_array = $uuid_field->view([]);
|
||||
$this->assertIdentical($render_array[0]['#context']['value'], $entity->uuid(), 'The rendered UUID matches the entity UUID.');
|
||||
$this->assertTrue(strpos($this->render($render_array), $entity->uuid()), 'The rendered UUID found.');
|
||||
$this->assertContains($entity->uuid(), $this->render($render_array), 'The rendered UUID found.');
|
||||
|
||||
// Verify customized render.
|
||||
$render_array = $uuid_field->view(['settings' => ['link_to_entity' => TRUE]]);
|
||||
|
@ -51,8 +51,8 @@ class UuidFormatterTest extends KernelTestBase {
|
|||
$this->assertIdentical($render_array[0]['#title']['#context']['value'], $entity->uuid());
|
||||
$this->assertIdentical($render_array[0]['#url']->toString(), $entity->toUrl()->toString());
|
||||
$rendered = $this->render($render_array);
|
||||
$this->assertTrue(strpos($rendered, $entity->uuid()), 'The rendered UUID found.');
|
||||
$this->assertTrue(strpos($rendered, $entity->toUrl()->toString()), 'The rendered entity URL found.');
|
||||
$this->assertContains($entity->uuid(), $rendered, 'The rendered UUID found.');
|
||||
$this->assertContains($entity->toUrl()->toString(), $rendered, 'The rendered entity URL found.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ class HandlerFieldFieldTest extends KernelTestBase {
|
|||
$field_name = $this->fieldStorages[6]->getName();
|
||||
$rendered_field = $view->style_plugin->getField($i, $field_name);
|
||||
// Check that a hidden field is not rendered.
|
||||
$this->assertFalse($rendered_field);
|
||||
$this->assertNull($rendered_field);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -231,9 +231,9 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
|
||||
// Check that fields of other entity types (here, the 'comment_body' field)
|
||||
// do not show up in the "Re-use existing field" list.
|
||||
$this->assertFalse($this->xpath('//select[@id="edit-existing-storage-name"]//option[@value="comment"]'), 'The list of options respects entity type restrictions.');
|
||||
$this->assertEmpty($this->xpath('//select[@id="edit-existing-storage-name"]//option[@value="comment"]'), 'The list of options respects entity type restrictions.');
|
||||
// Validate the FALSE assertion above by also testing a valid one.
|
||||
$this->assertTrue($this->xpath('//select[@id="edit-existing-storage-name"]//option[@value=:field_name]', [':field_name' => $this->fieldName]), 'The list of options shows a valid option.');
|
||||
$this->assertNotEmpty($this->xpath('//select[@id="edit-existing-storage-name"]//option[@value=:field_name]', [':field_name' => $this->fieldName]), 'The list of options shows a valid option.');
|
||||
|
||||
// Add a new field based on an existing field.
|
||||
$this->fieldUIAddExistingField("admin/structure/types/manage/page", $this->fieldName, $this->fieldLabel . '_2');
|
||||
|
@ -587,8 +587,8 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
public function testHiddenFields() {
|
||||
// Check that the field type is not available in the 'add new field' row.
|
||||
$this->drupalGet('admin/structure/types/manage/' . $this->contentType . '/fields/add-field');
|
||||
$this->assertFalse($this->xpath('//select[@id="edit-new-storage-type"]//option[@value="hidden_test_field"]'), "The 'add new field' select respects field types 'no_ui' property.");
|
||||
$this->assertTrue($this->xpath('//select[@id="edit-new-storage-type"]//option[@value="shape"]'), "The 'add new field' select shows a valid option.");
|
||||
$this->assertEmpty($this->xpath('//select[@id="edit-new-storage-type"]//option[@value="hidden_test_field"]'), "The 'add new field' select respects field types 'no_ui' property.");
|
||||
$this->assertNotEmpty($this->xpath('//select[@id="edit-new-storage-type"]//option[@value="shape"]'), "The 'add new field' select shows a valid option.");
|
||||
|
||||
// Create a field storage and a field programmatically.
|
||||
$field_name = 'hidden_test_field';
|
||||
|
@ -608,7 +608,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
->getFormDisplay('node', $this->contentType)
|
||||
->setComponent($field_name)
|
||||
->save();
|
||||
$this->assertTrue(FieldConfig::load('node.' . $this->contentType . '.' . $field_name), new FormattableMarkup('A field of the field storage %field was created programmatically.', ['%field' => $field_name]));
|
||||
$this->assertInstanceOf(FieldConfig::class, FieldConfig::load('node.' . $this->contentType . '.' . $field_name), new FormattableMarkup('A field of the field storage %field was created programmatically.', ['%field' => $field_name]));
|
||||
|
||||
// Check that the newly added field appears on the 'Manage Fields'
|
||||
// screen.
|
||||
|
@ -618,17 +618,17 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
// Check that the field does not appear in the 're-use existing field' row
|
||||
// on other bundles.
|
||||
$this->drupalGet('admin/structure/types/manage/page/fields/add-field');
|
||||
$this->assertFalse($this->xpath('//select[@id="edit-existing-storage-name"]//option[@value=:field_name]', [':field_name' => $field_name]), "The 're-use existing field' select respects field types 'no_ui' property.");
|
||||
$this->assertTrue($this->xpath('//select[@id="edit-existing-storage-name"]//option[@value=:field_name]', [':field_name' => 'field_tags']), "The 're-use existing field' select shows a valid option.");
|
||||
$this->assertEmpty($this->xpath('//select[@id="edit-existing-storage-name"]//option[@value=:field_name]', [':field_name' => $field_name]), "The 're-use existing field' select respects field types 'no_ui' property.");
|
||||
$this->assertNotEmpty($this->xpath('//select[@id="edit-existing-storage-name"]//option[@value=:field_name]', [':field_name' => 'field_tags']), "The 're-use existing field' select shows a valid option.");
|
||||
|
||||
// Check that non-configurable fields are not available.
|
||||
$field_types = \Drupal::service('plugin.manager.field.field_type')->getDefinitions();
|
||||
foreach ($field_types as $field_type => $definition) {
|
||||
if (empty($definition['no_ui'])) {
|
||||
$this->assertTrue($this->xpath('//select[@id="edit-new-storage-type"]//option[@value=:field_type]', [':field_type' => $field_type]), new FormattableMarkup('Configurable field type @field_type is available.', ['@field_type' => $field_type]));
|
||||
$this->assertNotEmpty($this->xpath('//select[@id="edit-new-storage-type"]//option[@value=:field_type]', [':field_type' => $field_type]), new FormattableMarkup('Configurable field type @field_type is available.', ['@field_type' => $field_type]));
|
||||
}
|
||||
else {
|
||||
$this->assertFalse($this->xpath('//select[@id="edit-new-storage-type"]//option[@value=:field_type]', [':field_type' => $field_type]), new FormattableMarkup('Non-configurable field type @field_type is not available.', ['@field_type' => $field_type]));
|
||||
$this->assertEmpty($this->xpath('//select[@id="edit-new-storage-type"]//option[@value=:field_type]', [':field_type' => $field_type]), new FormattableMarkup('Non-configurable field type @field_type is not available.', ['@field_type' => $field_type]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -399,18 +399,18 @@ class EntityDisplayTest extends KernelTestBase {
|
|||
|
||||
// Check the component exists.
|
||||
$display = $display_repository->getViewDisplay('entity_test', 'entity_test');
|
||||
$this->assertTrue($display->getComponent($field_name));
|
||||
$this->assertNotEmpty($display->getComponent($field_name));
|
||||
$display = $display_repository->getViewDisplay('entity_test', 'entity_test', 'teaser');
|
||||
$this->assertTrue($display->getComponent($field_name));
|
||||
$this->assertNotEmpty($display->getComponent($field_name));
|
||||
|
||||
// Delete the field.
|
||||
$field->delete();
|
||||
|
||||
// Check that the component has been removed from the entity displays.
|
||||
$display = $display_repository->getViewDisplay('entity_test', 'entity_test');
|
||||
$this->assertFalse($display->getComponent($field_name));
|
||||
$this->assertNull($display->getComponent($field_name));
|
||||
$display = $display_repository->getViewDisplay('entity_test', 'entity_test', 'teaser');
|
||||
$this->assertFalse($display->getComponent($field_name));
|
||||
$this->assertNull($display->getComponent($field_name));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -455,7 +455,7 @@ class EntityDisplayTest extends KernelTestBase {
|
|||
// Removing the text module should remove the field from the view display.
|
||||
\Drupal::service('config.manager')->uninstall('module', 'text');
|
||||
$display = $display_repository->getViewDisplay('entity_test', 'entity_test');
|
||||
$this->assertFalse($display->getComponent($field_name));
|
||||
$this->assertNull($display->getComponent($field_name));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -217,18 +217,18 @@ class EntityFormDisplayTest extends KernelTestBase {
|
|||
|
||||
// Check the component exists.
|
||||
$display = $display_repository->getFormDisplay('entity_test', 'entity_test');
|
||||
$this->assertTrue($display->getComponent($field_name));
|
||||
$this->assertNotEmpty($display->getComponent($field_name));
|
||||
$display = $display_repository->getFormDisplay('entity_test', 'entity_test', 'compact');
|
||||
$this->assertTrue($display->getComponent($field_name));
|
||||
$this->assertNotEmpty($display->getComponent($field_name));
|
||||
|
||||
// Delete the field.
|
||||
$field->delete();
|
||||
|
||||
// Check that the component has been removed from the entity displays.
|
||||
$display = $display_repository->getFormDisplay('entity_test', 'entity_test');
|
||||
$this->assertFalse($display->getComponent($field_name));
|
||||
$this->assertNull($display->getComponent($field_name));
|
||||
$display = $display_repository->getFormDisplay('entity_test', 'entity_test', 'compact');
|
||||
$this->assertFalse($display->getComponent($field_name));
|
||||
$this->assertNull($display->getComponent($field_name));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -273,7 +273,7 @@ class EntityFormDisplayTest extends KernelTestBase {
|
|||
// Removing the text module should remove the field from the form display.
|
||||
\Drupal::service('config.manager')->uninstall('module', 'text');
|
||||
$display = $display_repository->getFormDisplay('entity_test', 'entity_test');
|
||||
$this->assertFalse($display->getComponent($field_name));
|
||||
$this->assertNull($display->getComponent($field_name));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class DownloadTest extends FileManagedTestBase {
|
|||
file_test_set_return('download', ['x-foo' => 'Bar']);
|
||||
$this->drupalGet($url);
|
||||
$this->assertEqual($this->drupalGetHeader('x-foo'), 'Bar', 'Found header set by file_test module on private download.');
|
||||
$this->assertFalse($this->drupalGetHeader('x-drupal-cache'), 'Page cache is disabled on private file download.');
|
||||
$this->assertNull($this->drupalGetHeader('x-drupal-cache'), 'Page cache is disabled on private file download.');
|
||||
$this->assertResponse(200, 'Correctly allowed access to a file when file_test provides headers.');
|
||||
|
||||
// Test that the file transferred correctly.
|
||||
|
|
|
@ -93,7 +93,7 @@ class FileFieldPathTest extends FileFieldTestBase {
|
|||
$base_path = substr($expected_path, 0, $pos);
|
||||
$extension = substr($expected_path, $pos + 1);
|
||||
|
||||
$result = preg_match('/' . preg_quote($base_path, '/') . '(_[0-9]+)?\.' . preg_quote($extension, '/') . '/', $actual_path);
|
||||
$result = (bool) preg_match('/' . preg_quote($base_path, '/') . '(_[0-9]+)?\.' . preg_quote($extension, '/') . '/', $actual_path);
|
||||
$this->assertTrue($result, $message);
|
||||
}
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ abstract class FileFieldTestBase extends BrowserTestBase {
|
|||
public function assertFileEntryNotExists($file, $message) {
|
||||
$this->container->get('entity_type.manager')->getStorage('file')->resetCache();
|
||||
$message = isset($message) ? $message : new FormattableMarkup('File %file exists in database at the correct path.', ['%file' => $file->getFileUri()]);
|
||||
$this->assertFalse(File::load($file->id()), $message);
|
||||
$this->assertNull(File::load($file->id()), $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -115,7 +115,8 @@ class FileListingTest extends FileFieldTestBase {
|
|||
$this->assertLinkByHref(file_create_url($file->getFileUri()));
|
||||
$this->assertLinkByHref('admin/content/files/usage/' . $file->id());
|
||||
}
|
||||
$this->assertFalse(preg_match('/views-field-status priority-low\">\s*' . t('Temporary') . '/', $this->getSession()->getPage()->getContent()), 'All files are stored as permanent.');
|
||||
$this->assertSession()->elementTextNotContains('css', 'table.views-table', 'Temporary');
|
||||
$this->assertSession()->elementTextContains('css', 'table.views-table', 'Permanent');
|
||||
|
||||
// Use one file two times and check usage information.
|
||||
$orphaned_file = $nodes[1]->file->target_id;
|
||||
|
|
|
@ -150,7 +150,7 @@ class FilePrivateTest extends FileFieldTestBase {
|
|||
$file = end($files);
|
||||
$this->assertTrue($file->isTemporary(), 'File is temporary.');
|
||||
$usage = $this->container->get('file.usage')->listUsage($file);
|
||||
$this->assertFalse($usage, 'No file usage found.');
|
||||
$this->assertEmpty($usage, 'No file usage found.');
|
||||
$file_url = file_create_url($file->getFileUri());
|
||||
$this->drupalGet($file_url);
|
||||
$this->assertResponse(200, 'Confirmed that the anonymous uploader has access to the temporary file.');
|
||||
|
@ -178,7 +178,7 @@ class FilePrivateTest extends FileFieldTestBase {
|
|||
$file = File::load($file_id);
|
||||
$this->assertTrue($file->isTemporary(), 'File is temporary.');
|
||||
$usage = $this->container->get('file.usage')->listUsage($file);
|
||||
$this->assertFalse($usage, 'No file usage found.');
|
||||
$this->assertEmpty($usage, 'No file usage found.');
|
||||
$file_url = file_create_url($file->getFileUri());
|
||||
$this->drupalGet($file_url);
|
||||
$this->assertResponse(200, 'Confirmed that the anonymous uploader has access to the file whose references were removed.');
|
||||
|
@ -199,7 +199,7 @@ class FilePrivateTest extends FileFieldTestBase {
|
|||
$file = File::load($new_node->{$field_name}->target_id);
|
||||
$this->assertTrue($file->isPermanent(), 'File is permanent.');
|
||||
$usage = $this->container->get('file.usage')->listUsage($file);
|
||||
$this->assertTrue($usage, 'File usage found.');
|
||||
$this->assertCount(1, $usage, 'File usage found.');
|
||||
$file_url = file_create_url($file->getFileUri());
|
||||
$this->drupalGet($file_url);
|
||||
$this->assertResponse(200, 'Confirmed that the anonymous uploader has access to the permanent file that is referenced by a published node.');
|
||||
|
@ -224,7 +224,7 @@ class FilePrivateTest extends FileFieldTestBase {
|
|||
$file = File::load($new_node->{$field_name}->target_id);
|
||||
$this->assertTrue($file->isPermanent(), 'File is permanent.');
|
||||
$usage = $this->container->get('file.usage')->listUsage($file);
|
||||
$this->assertTrue($usage, 'File usage found.');
|
||||
$this->assertCount(1, $usage, 'File usage found.');
|
||||
$file_url = file_create_url($file->getFileUri());
|
||||
$this->drupalGet($file_url);
|
||||
$this->assertResponse(403, 'Confirmed that the anonymous uploader cannot access the permanent file when it is referenced by an unpublished node.');
|
||||
|
|
|
@ -102,7 +102,7 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
$max_fid_after = (int) \Drupal::entityQueryAggregate('file')->aggregate('fid', 'max')->execute()[0]['fid_max'];
|
||||
$this->assertTrue($max_fid_after > $this->maxFidBefore, 'A new file was created.');
|
||||
$file1 = File::load($max_fid_after);
|
||||
$this->assertTrue($file1, 'Loaded the file.');
|
||||
$this->assertInstanceOf(File::class, $file1, 'Loaded the file.');
|
||||
// MIME type of the uploaded image may be either image/jpeg or image/png.
|
||||
$this->assertEqual(substr($file1->getMimeType(), 0, 5), 'image', 'A MIME type was set.');
|
||||
|
||||
|
@ -123,7 +123,7 @@ class SaveUploadFormTest extends FileManagedTestBase {
|
|||
$this->assertFileHooksCalled(['validate', 'insert']);
|
||||
|
||||
$file2 = File::load($max_fid_after);
|
||||
$this->assertTrue($file2, 'Loaded the file');
|
||||
$this->assertInstanceOf(File::class, $file2, 'Loaded the file');
|
||||
// MIME type of the uploaded image may be either image/jpeg or image/png.
|
||||
$this->assertEqual(substr($file2->getMimeType(), 0, 5), 'image', 'A MIME type was set.');
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
$max_fid_after = (int) \Drupal::entityQueryAggregate('file')->aggregate('fid', 'max')->execute()[0]['fid_max'];
|
||||
$this->assertTrue($max_fid_after > $this->maxFidBefore, 'A new file was created.');
|
||||
$file1 = File::load($max_fid_after);
|
||||
$this->assertTrue($file1, 'Loaded the file.');
|
||||
$this->assertInstanceOf(File::class, $file1, 'Loaded the file.');
|
||||
// MIME type of the uploaded image may be either image/jpeg or image/png.
|
||||
$this->assertEqual(substr($file1->getMimeType(), 0, 5), 'image', 'A MIME type was set.');
|
||||
|
||||
|
@ -116,7 +116,7 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
$this->assertFileHooksCalled(['validate', 'insert']);
|
||||
|
||||
$file2 = File::load($max_fid_after);
|
||||
$this->assertTrue($file2, 'Loaded the file');
|
||||
$this->assertInstanceOf(File::class, $file2, 'Loaded the file');
|
||||
// MIME type of the uploaded image may be either image/jpeg or image/png.
|
||||
$this->assertEqual(substr($file2->getMimeType(), 0, 5), 'image', 'A MIME type was set.');
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class CopyTest extends FileManagedUnitTestBase {
|
|||
$result = file_copy(clone $source, $desired_uri, FileSystemInterface::EXISTS_ERROR);
|
||||
|
||||
// Check the return status and that the contents changed.
|
||||
$this->assertTrue($result, 'File copied successfully.');
|
||||
$this->assertNotFalse($result, 'File copied successfully.');
|
||||
$this->assertEqual($contents, file_get_contents($result->getFileUri()), 'Contents of file were copied correctly.');
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
|
@ -56,7 +56,7 @@ class CopyTest extends FileManagedUnitTestBase {
|
|||
$result = file_copy(clone $source, $target->getFileUri(), FileSystemInterface::EXISTS_RENAME);
|
||||
|
||||
// Check the return status and that the contents changed.
|
||||
$this->assertTrue($result, 'File copied successfully.');
|
||||
$this->assertNotFalse($result, 'File copied successfully.');
|
||||
$this->assertEqual($contents, file_get_contents($result->getFileUri()), 'Contents of file were copied correctly.');
|
||||
$this->assertNotEqual($result->getFileUri(), $source->getFileUri(), 'Returned file path has changed from the original.');
|
||||
|
||||
|
@ -96,7 +96,7 @@ class CopyTest extends FileManagedUnitTestBase {
|
|||
$result = file_copy(clone $source, $target->getFileUri(), FileSystemInterface::EXISTS_REPLACE);
|
||||
|
||||
// Check the return status and that the contents changed.
|
||||
$this->assertTrue($result, 'File copied successfully.');
|
||||
$this->assertNotFalse($result, 'File copied successfully.');
|
||||
$this->assertEqual($contents, file_get_contents($result->getFileUri()), 'Contents of file were overwritten.');
|
||||
$this->assertDifferentFile($source, $result);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class DeleteTest extends FileManagedUnitTestBase {
|
|||
$file->delete();
|
||||
$this->assertFileHooksCalled(['delete']);
|
||||
$this->assertFalse(file_exists($file->getFileUri()), 'Test file has actually been deleted.');
|
||||
$this->assertFalse(File::load($file->id()), 'File was removed from the database.');
|
||||
$this->assertNull(File::load($file->id()), 'File was removed from the database.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,7 +44,7 @@ class DeleteTest extends FileManagedUnitTestBase {
|
|||
$usage = $file_usage->listUsage($file);
|
||||
$this->assertEqual($usage['testing']['test'], [1 => 1], 'Test file is still in use.');
|
||||
$this->assertTrue(file_exists($file->getFileUri()), 'File still exists on the disk.');
|
||||
$this->assertTrue(File::load($file->id()), 'File still exists in the database.');
|
||||
$this->assertNotEmpty(File::load($file->id()), 'File still exists in the database.');
|
||||
|
||||
// Clear out the call to hook_file_load().
|
||||
file_test_reset();
|
||||
|
@ -55,7 +55,7 @@ class DeleteTest extends FileManagedUnitTestBase {
|
|||
$this->assertTrue(empty($usage), 'File usage data was removed.');
|
||||
$this->assertTrue(file_exists($file->getFileUri()), 'File still exists on the disk.');
|
||||
$file = File::load($file->id());
|
||||
$this->assertTrue($file, 'File still exists in the database.');
|
||||
$this->assertNotEmpty($file, 'File still exists in the database.');
|
||||
$this->assertTrue($file->isTemporary(), 'File is temporary.');
|
||||
file_test_reset();
|
||||
|
||||
|
@ -74,7 +74,7 @@ class DeleteTest extends FileManagedUnitTestBase {
|
|||
// file_cron() loads
|
||||
$this->assertFileHooksCalled(['delete']);
|
||||
$this->assertFalse(file_exists($file->getFileUri()), 'File has been deleted after its last usage was removed.');
|
||||
$this->assertFalse(File::load($file->id()), 'File was removed from the database.');
|
||||
$this->assertNull(File::load($file->id()), 'File was removed from the database.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,7 +85,7 @@ class DeleteTest extends FileManagedUnitTestBase {
|
|||
// Delete the file, but leave it in the file_managed table.
|
||||
\Drupal::service('file_system')->delete($file->getFileUri());
|
||||
$this->assertFalse(file_exists($file->getFileUri()), 'File is deleted from the filesystem.');
|
||||
$this->assertTrue(File::load($file->id()), 'File exist in file_managed table');
|
||||
$this->assertInstanceOf(File::class, File::load($file->id()), 'File exist in file_managed table');
|
||||
|
||||
// Call file_cron() to clean up the file. Make sure the changed timestamp
|
||||
// of the file is older than the system.file.temporary_maximum_age
|
||||
|
@ -98,7 +98,7 @@ class DeleteTest extends FileManagedUnitTestBase {
|
|||
->execute();
|
||||
\Drupal::service('cron')->run();
|
||||
|
||||
$this->assertFalse(File::load($file->id()), 'File was removed from the database.');
|
||||
$this->assertNull(File::load($file->id()), 'File was removed from the database.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class LoadTest extends FileManagedUnitTestBase {
|
|||
* Try to load a non-existent file by fid.
|
||||
*/
|
||||
public function testLoadMissingFid() {
|
||||
$this->assertFalse(File::load(-1), 'Try to load an invalid fid fails.');
|
||||
$this->assertNull(File::load(-1), 'Try to load an invalid fid fails.');
|
||||
$this->assertFileHooksCalled([]);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class MoveTest extends FileManagedUnitTestBase {
|
|||
$result = file_move(clone $source, $desired_filepath, FileSystemInterface::EXISTS_ERROR);
|
||||
|
||||
// Check the return status and that the contents changed.
|
||||
$this->assertTrue($result, 'File moved successfully.');
|
||||
$this->assertNotFalse($result, 'File moved successfully.');
|
||||
$this->assertFalse(file_exists($source->getFileUri()));
|
||||
$this->assertEqual($contents, file_get_contents($result->getFileUri()), 'Contents of file correctly written.');
|
||||
|
||||
|
@ -39,7 +39,7 @@ class MoveTest extends FileManagedUnitTestBase {
|
|||
// Reload the file from the database and check that the changes were
|
||||
// actually saved.
|
||||
$loaded_file = File::load($result->id());
|
||||
$this->assertTrue($loaded_file, 'File can be loaded from the database.');
|
||||
$this->assertNotEmpty($loaded_file, 'File can be loaded from the database.');
|
||||
$this->assertFileUnchanged($result, $loaded_file);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ class MoveTest extends FileManagedUnitTestBase {
|
|||
$result = file_move(clone $source, $target->getFileUri(), FileSystemInterface::EXISTS_RENAME);
|
||||
|
||||
// Check the return status and that the contents changed.
|
||||
$this->assertTrue($result, 'File moved successfully.');
|
||||
$this->assertNotFalse($result, 'File moved successfully.');
|
||||
$this->assertFalse(file_exists($source->getFileUri()));
|
||||
$this->assertEqual($contents, file_get_contents($result->getFileUri()), 'Contents of file correctly written.');
|
||||
|
||||
|
@ -95,7 +95,7 @@ class MoveTest extends FileManagedUnitTestBase {
|
|||
// Look at the results.
|
||||
$this->assertEqual($contents, file_get_contents($result->getFileUri()), 'Contents of file were overwritten.');
|
||||
$this->assertFalse(file_exists($source->getFileUri()));
|
||||
$this->assertTrue($result, 'File moved successfully.');
|
||||
$this->assertNotEmpty($result, 'File moved successfully.');
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
$this->assertFileHooksCalled(['move', 'update', 'delete', 'load']);
|
||||
|
|
|
@ -20,7 +20,7 @@ class SaveDataTest extends FileManagedUnitTestBase {
|
|||
$contents = $this->randomMachineName(8);
|
||||
|
||||
$result = file_save_data($contents);
|
||||
$this->assertTrue($result, 'Unnamed file saved correctly.');
|
||||
$this->assertNotFalse($result, 'Unnamed file saved correctly.');
|
||||
|
||||
$stream_wrapper_manager = \Drupal::service('stream_wrapper_manager');
|
||||
assert($stream_wrapper_manager instanceof StreamWrapperManagerInterface);
|
||||
|
@ -47,7 +47,7 @@ class SaveDataTest extends FileManagedUnitTestBase {
|
|||
$filename = 'Текстовый файл.txt';
|
||||
|
||||
$result = file_save_data($contents, 'public://' . $filename);
|
||||
$this->assertTrue($result, 'Unnamed file saved correctly.');
|
||||
$this->assertNotFalse($result, 'Unnamed file saved correctly.');
|
||||
|
||||
$stream_wrapper_manager = \Drupal::service('stream_wrapper_manager');
|
||||
assert($stream_wrapper_manager instanceof StreamWrapperManagerInterface);
|
||||
|
@ -73,7 +73,7 @@ class SaveDataTest extends FileManagedUnitTestBase {
|
|||
$contents = $this->randomMachineName(8);
|
||||
|
||||
$result = file_save_data($contents, $existing->getFileUri(), FileSystemInterface::EXISTS_RENAME);
|
||||
$this->assertTrue($result, 'File saved successfully.');
|
||||
$this->assertNotFalse($result, 'File saved successfully.');
|
||||
|
||||
$stream_wrapper_manager = \Drupal::service('stream_wrapper_manager');
|
||||
assert($stream_wrapper_manager instanceof StreamWrapperManagerInterface);
|
||||
|
@ -103,7 +103,7 @@ class SaveDataTest extends FileManagedUnitTestBase {
|
|||
$contents = $this->randomMachineName(8);
|
||||
|
||||
$result = file_save_data($contents, $existing->getFileUri(), FileSystemInterface::EXISTS_REPLACE);
|
||||
$this->assertTrue($result, 'File saved successfully.');
|
||||
$this->assertNotFalse($result, 'File saved successfully.');
|
||||
|
||||
$stream_wrapper_manager = \Drupal::service('stream_wrapper_manager');
|
||||
assert($stream_wrapper_manager instanceof StreamWrapperManagerInterface);
|
||||
|
|
|
@ -299,7 +299,7 @@ class FilterAdminTest extends BrowserTestBase {
|
|||
$this->assertNotEmpty($view_link, 'The message area contains a link to a node');
|
||||
|
||||
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
|
||||
$this->assertTrue($node, 'Node found in database.');
|
||||
$this->assertNotEmpty($node, 'Node found in database.');
|
||||
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
$this->assertRaw($body . $extra_text, 'Filter removed invalid tag.');
|
||||
|
|
|
@ -39,7 +39,7 @@ class FilterDefaultConfigTest extends KernelTestBase {
|
|||
$this->assertEqual($format->get('weight'), 2);
|
||||
|
||||
// Verify that format default property values have been added/injected.
|
||||
$this->assertTrue($format->uuid());
|
||||
$this->assertNotEmpty($format->uuid());
|
||||
|
||||
// Verify that the loaded format does not contain any roles.
|
||||
$this->assertEqual($format->get('roles'), NULL);
|
||||
|
|
|
@ -289,7 +289,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
$directory = 'public://styles/' . $style_name;
|
||||
$this->assertFalse(is_dir($directory), new FormattableMarkup('Image style %style directory removed on style deletion.', ['%style' => $style->label()]));
|
||||
|
||||
$this->assertFalse(ImageStyle::load($style_name), new FormattableMarkup('Image style %style successfully deleted.', ['%style' => $style->label()]));
|
||||
$this->assertNull(ImageStyle::load($style_name), new FormattableMarkup('Image style %style successfully deleted.', ['%style' => $style->label()]));
|
||||
|
||||
// Test empty text when there are no image styles.
|
||||
|
||||
|
@ -499,7 +499,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
$sync->delete('image.style.' . $style_name);
|
||||
$this->configImporter()->import();
|
||||
|
||||
$this->assertFalse(ImageStyle::load($style_name), 'Style deleted after config import.');
|
||||
$this->assertNull(ImageStyle::load($style_name), 'Style deleted after config import.');
|
||||
$this->assertEqual($this->getImageCount($style), 0, 'Image style was flushed after being deleted by config import.');
|
||||
}
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
$file = $node->{$field_name}->entity;
|
||||
|
||||
$url = file_url_transform_relative(ImageStyle::load('medium')->buildUrl($file->getFileUri()));
|
||||
$this->assertTrue($this->cssSelect('img[width=40][height=20][class=image-style-medium][src="' . $url . '"]'));
|
||||
$this->assertSession()->elementExists('css', 'img[width=40][height=20][class=image-style-medium][src="' . $url . '"]');
|
||||
|
||||
// Add alt/title fields to the image and verify that they are displayed.
|
||||
$image = [
|
||||
|
@ -439,7 +439,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
\Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
|
||||
$field_storage = FieldStorageConfig::loadByName('node', $field_name);
|
||||
$default_image = $field_storage->getSetting('default_image');
|
||||
$this->assertFalse($default_image['uuid'], 'Default image removed from field.');
|
||||
$this->assertEmpty($default_image['uuid'], 'Default image removed from field.');
|
||||
// Create an image field that uses the private:// scheme and test that the
|
||||
// default image works as expected.
|
||||
$private_field_name = strtolower($this->randomMachineName());
|
||||
|
|
|
@ -131,7 +131,7 @@ class QuickEditImageControllerTest extends BrowserTestBase {
|
|||
break;
|
||||
}
|
||||
}
|
||||
$this->assertTrue($valid_image);
|
||||
$this->assertNotFalse($valid_image);
|
||||
|
||||
$this->drupalLogin($this->contentAuthorUser);
|
||||
$this->uploadImage($valid_image, $node->id(), $this->fieldName, $node->language()->getId());
|
||||
|
@ -160,7 +160,7 @@ class QuickEditImageControllerTest extends BrowserTestBase {
|
|||
break;
|
||||
}
|
||||
}
|
||||
$this->assertTrue($invalid_image);
|
||||
$this->assertNotFalse($invalid_image);
|
||||
|
||||
$this->drupalLogin($this->contentAuthorUser);
|
||||
$this->uploadImage($invalid_image, $node->id(), $this->fieldName, $node->language()->getId());
|
||||
|
|
|
@ -59,7 +59,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
$this->getSession()->getPage()->pressButton('Ajax refresh');
|
||||
$this->assertTrue($page->waitFor(10, function ($page) {
|
||||
$ajax_value = $page->find('css', '#ajax-value')->getText();
|
||||
return preg_match('/^Ajax value [0-9.]+ [0-9.]+$/', $ajax_value);
|
||||
return (bool) preg_match('/^Ajax value [0-9.]+ [0-9.]+$/', $ajax_value);
|
||||
}));
|
||||
$page->pressButton('Update effect');
|
||||
$assert->pageTextContains('The image effect was successfully applied.');
|
||||
|
|
|
@ -319,7 +319,7 @@ class JsonApiFunctionalMultilingualTest extends JsonApiFunctionalTestBase {
|
|||
|
||||
$response = $this->request('DELETE', Url::fromUri('base:/jsonapi/node/article/' . $this->nodes[0]->uuid()), []);
|
||||
$this->assertSame(204, $response->getStatusCode());
|
||||
$this->assertFalse(Node::load($this->nodes[0]->id()));
|
||||
$this->assertNull(Node::load($this->nodes[0]->id()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,32 +79,32 @@ class LanguageBrowserDetectionAcceptLanguageTest extends BrowserTestBase {
|
|||
|
||||
$this->drupalGet('/system-test/echo/language test', [], ['Accept-Language' => 'en']);
|
||||
$this->assertSession()->responseHeaderEquals('Content-Language', 'en');
|
||||
$this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
$this->assertNull($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
|
||||
// Check with UK browser.
|
||||
$this->drupalGet('/system-test/echo/language test', [], ['Accept-Language' => 'en-UK,en']);
|
||||
$this->assertSession()->responseHeaderEquals('Content-Language', 'en');
|
||||
$this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
$this->assertNull($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
|
||||
// Check with french browser.
|
||||
$this->drupalGet('/system-test/echo/language test', [], ['Accept-Language' => 'fr-FR,fr']);
|
||||
$this->assertSession()->responseHeaderEquals('Content-Language', 'fr');
|
||||
$this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
$this->assertNull($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
|
||||
// Check with browser without language settings - should return fallback language.
|
||||
$this->drupalGet('/system-test/echo/language test', [], ['Accept-Language' => NULL]);
|
||||
$this->assertSession()->responseHeaderEquals('Content-Language', 'en');
|
||||
$this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
$this->assertNull($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
|
||||
// Check with french browser again.
|
||||
$this->drupalGet('/system-test/echo/language test', [], ['Accept-Language' => 'fr-FR,fr']);
|
||||
$this->assertSession()->responseHeaderEquals('Content-Language', 'fr');
|
||||
$this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
$this->assertNull($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
|
||||
// Check with UK browser.
|
||||
$this->drupalGet('/system-test/echo/language test', [], ['Accept-Language' => 'en-UK,en']);
|
||||
$this->assertSession()->responseHeaderEquals('Content-Language', 'en');
|
||||
$this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
$this->assertNull($this->drupalGetHeader('X-Drupal-Cache'));
|
||||
|
||||
// Check if prefixed URLs are still cached.
|
||||
$this->drupalGet('/en/system-test/echo/language test', [], ['Accept-Language' => 'en']);
|
||||
|
|
|
@ -209,7 +209,7 @@ class LanguageConfigurationElementTest extends BrowserTestBase {
|
|||
|
||||
// Check the language default configuration for articles is present.
|
||||
$configuration = \Drupal::entityTypeManager()->getStorage('language_content_settings')->load('node.article');
|
||||
$this->assertTrue($configuration, 'The language configuration is present.');
|
||||
$this->assertNotEmpty($configuration, 'The language configuration is present.');
|
||||
|
||||
// Delete 'article' bundle.
|
||||
$this->drupalPostForm('admin/structure/types/manage/article/delete', [], t('Delete'));
|
||||
|
@ -217,7 +217,7 @@ class LanguageConfigurationElementTest extends BrowserTestBase {
|
|||
// Check that the language configuration has been deleted.
|
||||
\Drupal::entityTypeManager()->getStorage('language_content_settings')->resetCache();
|
||||
$configuration = \Drupal::entityTypeManager()->getStorage('language_content_settings')->load('node.article');
|
||||
$this->assertFalse($configuration, 'The language configuration was deleted after bundle was deleted.');
|
||||
$this->assertNull($configuration, 'The language configuration was deleted after bundle was deleted.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -567,7 +567,7 @@ class LanguageUILanguageNegotiationTest extends BrowserTestBase {
|
|||
|
||||
// Check if the language switcher block has been created.
|
||||
$block = Block::load($block_id);
|
||||
$this->assertTrue($block, 'Language switcher block was created.');
|
||||
$this->assertNotEmpty($block, 'Language switcher block was created.');
|
||||
|
||||
// Make sure language_content is not configurable.
|
||||
$edit = [
|
||||
|
@ -578,7 +578,7 @@ class LanguageUILanguageNegotiationTest extends BrowserTestBase {
|
|||
|
||||
// Check if the language switcher block has been removed.
|
||||
$block = Block::load($block_id);
|
||||
$this->assertFalse($block, 'Language switcher block was removed.');
|
||||
$this->assertNull($block, 'Language switcher block was removed.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class LocaleConfigTranslationTest extends BrowserTestBase {
|
|||
// Check that the maintenance message exists and create translation for it.
|
||||
$source = '@site is currently under maintenance. We should be back shortly. Thank you for your patience.';
|
||||
$string = $this->storage->findString(['source' => $source, 'context' => '', 'type' => 'configuration']);
|
||||
$this->assertTrue($string, 'Configuration strings have been created upon installation.');
|
||||
$this->assertNotEmpty($string, 'Configuration strings have been created upon installation.');
|
||||
|
||||
// Translate using the UI so configuration is refreshed.
|
||||
$message = $this->randomMachineName(20);
|
||||
|
@ -95,7 +95,7 @@ class LocaleConfigTranslationTest extends BrowserTestBase {
|
|||
|
||||
// Check default medium date format exists and create a translation for it.
|
||||
$string = $this->storage->findString(['source' => 'D, m/d/Y - H:i', 'context' => 'PHP date format', 'type' => 'configuration']);
|
||||
$this->assertTrue($string, 'Configuration date formats have been created upon installation.');
|
||||
$this->assertNotEmpty($string, 'Configuration date formats have been created upon installation.');
|
||||
|
||||
// Translate using the UI so configuration is refreshed.
|
||||
$search = [
|
||||
|
@ -122,14 +122,14 @@ class LocaleConfigTranslationTest extends BrowserTestBase {
|
|||
|
||||
// Assert strings from image module config are not available.
|
||||
$string = $this->storage->findString(['source' => 'Medium (220×220)', 'context' => '', 'type' => 'configuration']);
|
||||
$this->assertFalse($string, 'Configuration strings have been created upon installation.');
|
||||
$this->assertNull($string, 'Configuration strings have been created upon installation.');
|
||||
|
||||
// Enable the image module.
|
||||
$this->drupalPostForm('admin/modules', ['modules[image][enable]' => "1"], t('Install'));
|
||||
$this->rebuildContainer();
|
||||
|
||||
$string = $this->storage->findString(['source' => 'Medium (220×220)', 'context' => '', 'type' => 'configuration']);
|
||||
$this->assertTrue($string, 'Configuration strings have been created upon installation.');
|
||||
$this->assertNotEmpty($string, 'Configuration strings have been created upon installation.');
|
||||
$locations = $string->getLocations();
|
||||
$this->assertTrue(isset($locations['configuration']) && isset($locations['configuration']['image.style.medium']), 'Configuration string has been created with the right location');
|
||||
|
||||
|
@ -138,7 +138,7 @@ class LocaleConfigTranslationTest extends BrowserTestBase {
|
|||
$this->assertEqual(count($translations), 1);
|
||||
$translation = reset($translations);
|
||||
$this->assertEqual($translation->source, $string->source);
|
||||
$this->assertTrue(empty($translation->translation));
|
||||
$this->assertEmpty($translation->translation);
|
||||
|
||||
// Translate using the UI so configuration is refreshed.
|
||||
$image_style_label = $this->randomMachineName(20);
|
||||
|
@ -229,22 +229,22 @@ class LocaleConfigTranslationTest extends BrowserTestBase {
|
|||
$string = $this->storage->findString(['source' => 'Make content sticky', 'context' => '', 'type' => 'configuration']);
|
||||
if ($required) {
|
||||
$this->assertFalse($this->config('system.action.node_make_sticky_action')->isNew());
|
||||
$this->assertTrue($string, 'Node action text can be found with node module.');
|
||||
$this->assertNotEmpty($string, 'Node action text can be found with node module.');
|
||||
}
|
||||
else {
|
||||
$this->assertTrue($this->config('system.action.node_make_sticky_action')->isNew());
|
||||
$this->assertFalse($string, 'Node action text can not be found without node module.');
|
||||
$this->assertNull($string, 'Node action text can not be found without node module.');
|
||||
}
|
||||
|
||||
// Check the optional default configuration in node module.
|
||||
$string = $this->storage->findString(['source' => 'No front page content has been created yet.<br/>Follow the <a target="_blank" href="https://www.drupal.org/docs/user_guide/en/index.html">User Guide</a> to start building your site.', 'context' => '', 'type' => 'configuration']);
|
||||
if ($optional) {
|
||||
$this->assertFalse($this->config('views.view.frontpage')->isNew());
|
||||
$this->assertTrue($string, 'Node view text can be found with node and views modules.');
|
||||
$this->assertNotEmpty($string, 'Node view text can be found with node and views modules.');
|
||||
}
|
||||
else {
|
||||
$this->assertTrue($this->config('views.view.frontpage')->isNew());
|
||||
$this->assertFalse($string, 'Node view text can not be found without node and/or views modules.');
|
||||
$this->assertNull($string, 'Node view text can not be found without node and/or views modules.');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -317,7 +317,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
|
|||
$locale_storage = $this->container->get('locale.storage');
|
||||
foreach ($config_strings as $config_string) {
|
||||
$string = $locale_storage->findString(['source' => $config_string[0], 'context' => '', 'type' => 'configuration']);
|
||||
$this->assertTrue($string, 'Configuration strings have been created upon installation.');
|
||||
$this->assertNotEmpty($string, 'Configuration strings have been created upon installation.');
|
||||
}
|
||||
|
||||
// Import a .po file to translate.
|
||||
|
|
|
@ -91,7 +91,7 @@ abstract class LocaleUpdateBase extends BrowserTestBase {
|
|||
$edit = ['predefined_langcode' => $langcode];
|
||||
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
|
||||
$this->container->get('language_manager')->reset();
|
||||
$this->assertTrue(\Drupal::languageManager()->getLanguage($langcode), new FormattableMarkup('Language %langcode added.', ['%langcode' => $langcode]));
|
||||
$this->assertNotEmpty(\Drupal::languageManager()->getLanguage($langcode), new FormattableMarkup('Language %langcode added.', ['%langcode' => $langcode]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -122,7 +122,7 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase {
|
|||
'@date' => $this->container->get('date.formatter')->format(REQUEST_TIME, 'html_date'),
|
||||
]), 'Core translation update');
|
||||
$update_button = $this->xpath('//input[@type="submit"][@value="' . t('Update translations') . '"]');
|
||||
$this->assertTrue($update_button, 'Update translations button');
|
||||
$this->assertNotEmpty($update_button, 'Update translations button');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -354,7 +354,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
|
|||
// Check if the language data is added to the database.
|
||||
$connection = Database::getConnection();
|
||||
$result = $connection->query("SELECT project FROM {locale_file} WHERE langcode='nl'")->fetchField();
|
||||
$this->assertTrue($result, 'Files added to file history');
|
||||
$this->assertNotEmpty($result, 'Files added to file history');
|
||||
|
||||
// Remove a language.
|
||||
$this->drupalPostForm('admin/config/regional/language/delete/nl', [], t('Delete'));
|
||||
|
|
|
@ -53,7 +53,7 @@ class LocaleStringTest extends KernelTestBase {
|
|||
public function testStringCrudApi() {
|
||||
// Create source string.
|
||||
$source = $this->buildSourceString()->save();
|
||||
$this->assertTrue($source->lid);
|
||||
$this->assertNotEmpty($source->lid);
|
||||
|
||||
// Load strings by lid and source.
|
||||
$string1 = $this->storage->findString(['lid' => $source->lid]);
|
||||
|
@ -61,7 +61,7 @@ class LocaleStringTest extends KernelTestBase {
|
|||
$string2 = $this->storage->findString(['source' => $source->source, 'context' => $source->context]);
|
||||
$this->assertEquals($source, $string2);
|
||||
$string3 = $this->storage->findString(['source' => $source->source, 'context' => '']);
|
||||
$this->assertFalse($string3);
|
||||
$this->assertNull($string3);
|
||||
|
||||
// Check version handling and updating.
|
||||
$this->assertEquals('none', $source->version);
|
||||
|
@ -96,9 +96,9 @@ class LocaleStringTest extends KernelTestBase {
|
|||
|
||||
$source->delete();
|
||||
$string = $this->storage->findString(['lid' => $lid]);
|
||||
$this->assertFalse($string);
|
||||
$this->assertNull($string);
|
||||
$deleted = $search = $this->storage->getTranslations(['lid' => $lid]);
|
||||
$this->assertFalse($deleted);
|
||||
$this->assertEmpty($deleted);
|
||||
|
||||
// Tests that locations of different types and arbitrary lengths can be
|
||||
// added to a source string. Too long locations will be cut off.
|
||||
|
|
|
@ -140,7 +140,7 @@ class MediaUiFunctionalTest extends MediaFunctionalTestBase {
|
|||
$assert_session->pageTextContains('This action cannot be undone');
|
||||
$page->pressButton('Delete');
|
||||
$media_id = \Drupal::entityQuery('media')->execute();
|
||||
$this->assertFalse($media_id);
|
||||
$this->assertEmpty($media_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,7 +48,7 @@ class MediaViewsWizardTest extends MediaJavascriptTestBase {
|
|||
// Check for the default filters.
|
||||
$this->assertSame($view->filter['status']->table, 'media_field_data');
|
||||
$this->assertSame($view->filter['status']->field, 'status');
|
||||
$this->assertTrue($view->filter['status']->value);
|
||||
$this->assertSame($view->filter['status']->value, '1');
|
||||
// Check for the default fields.
|
||||
$this->assertSame($view->field['name']->table, 'media_field_data');
|
||||
$this->assertSame($view->field['name']->field, 'name');
|
||||
|
@ -82,7 +82,7 @@ class MediaViewsWizardTest extends MediaJavascriptTestBase {
|
|||
// Check for the default filters.
|
||||
$this->assertSame($view->filter['status']->table, 'media_field_revision');
|
||||
$this->assertSame($view->filter['status']->field, 'status');
|
||||
$this->assertTrue($view->filter['status']->value);
|
||||
$this->assertSame($view->filter['status']->value, '1');
|
||||
|
||||
// Check for the default fields.
|
||||
$this->assertSame($view->field['name']->table, 'media_field_revision');
|
||||
|
|
|
@ -121,13 +121,13 @@ class EmbeddedFormWidgetTest extends WebDriverTestBase {
|
|||
$this->drupalGet('node/add/basic_page');
|
||||
$wrapper = $assert_session->elementExists('css', '#media_image_field-media-library-wrapper');
|
||||
$wrapper->pressButton('Add media');
|
||||
$this->assertTrue($assert_session->waitForText('Add or select media'));
|
||||
$this->assertNotNull($assert_session->waitForText('Add or select media'));
|
||||
$page->attachFileToField('Add file', $this->container->get('file_system')->realpath($jpg_image->uri));
|
||||
$this->assertTrue($assert_session->waitForText('Alternative text'));
|
||||
$this->assertNotNull($assert_session->waitForText('Alternative text'));
|
||||
$page->fillField('Alternative text', $this->randomString());
|
||||
$assert_session->elementExists('css', '.ui-dialog-buttonpane')->pressButton('Save and insert');
|
||||
$first_item_locator = "(//div[@data-drupal-selector='edit-media-image-field-selection-0'])[1]";
|
||||
$this->assertTrue($first_item = $assert_session->waitForElementVisible('xpath', $first_item_locator));
|
||||
$this->assertNotNull($first_item = $assert_session->waitForElementVisible('xpath', $first_item_locator));
|
||||
$first_item->pressButton('Remove');
|
||||
$assert_session->waitForElementRemoved('xpath', $first_item_locator);
|
||||
$page->waitFor(10, function () use ($wrapper) {
|
||||
|
@ -135,11 +135,11 @@ class EmbeddedFormWidgetTest extends WebDriverTestBase {
|
|||
});
|
||||
// Test reinserting the same selection.
|
||||
$wrapper->pressButton('Add media');
|
||||
$this->assertTrue($assert_session->waitForText('Add or select media'));
|
||||
$this->assertNotNull($assert_session->waitForText('Add or select media'));
|
||||
$assert_session->elementExists('xpath', "(//div[contains(@class, 'media-library-item')])[1]")->click();
|
||||
$assert_session->checkboxChecked('media_library_select_form[0]');
|
||||
$assert_session->elementExists('css', '.ui-dialog-buttonpane')->pressButton('Insert selected');
|
||||
$this->assertTrue($assert_session->waitForElementVisible('xpath', $first_item_locator));
|
||||
$this->assertNotNull($assert_session->waitForElementVisible('xpath', $first_item_locator));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue