Commit a02891d1 authored by catch's avatar catch

Issue #2742585 by ZeiP, alexpott, mondrake, klausi, tomasnagy, Krzysztof...

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 19aae044
......@@ -33,7 +33,7 @@ public function testActionUninstall() {
$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 @@ public function testActionConfiguration() {
$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 @@ public function updateAndDelete(FeedInterface $feed, $expected_count) {
$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 @@ public function testAggregatorFeedImport() {
$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 @@ public function testIPAddressValidation() {
$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 @@ public function testIPAddressValidation() {
$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 @@ public function testBasicAuth() {
$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 @@ public function testBasicAuth() {
$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 @@ public function testBlockValidateErrors() {
$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 @@ public function testDeleteBlockDisplay() {
$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 @@ public function testDeleteBlockDisplay() {
$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 @@ protected function loadTests() {
$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 @@ protected function verifyRenderCacheHandling() {
$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 @@ protected function verifyRenderCacheHandling() {
$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 @@ protected function assertBlockRenderedWithExpectedCacheability(array $expected_k
$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 @@ public function testBlockContentCreation() {
->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 @@ public function testBlockContentCreationMultipleViewModes() {
->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 @@ public function testDefaultBlockContentCreation() {
->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 @@ public function testListing() {
// 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 @@ public function testListing() {
// 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 @@ public function testImport() {
// 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 @@ public function testBlockContentTypeCreation() {
];
$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 @@ public function testBlockContentTypeCreation() {
$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 @@ public function testPageEdit() {
// 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 @@ public function testBookWithPendingRevisions() {
];
$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 @@ public function testExistingFormat() {
// 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 @@ public function testExistingFormat() {
// 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 @@ public function testNewFormat() {
];
$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 @@ public function testCommentClasses() {
// 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 @@ public function testCommentClasses() {
// 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 @@ public function testCommentDefaultFields() {
// 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 @@ public function testCommentDefaultFields() {
// 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 @@ public function testCommentInterface() {
// 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 @@ public function testCommentFunctionality() {
// 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 @@ public function setCommentSettings($name, $value, $message, $field_name = 'comme
* 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 @@ public function testCommentPopulatedTitles() {
$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 @@ public function testCommentTypeCreation() {
$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 @@ public function testCommentTypeCreation() {
];
$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 @@ public function testCommentTypeEditing() {
$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 @@ public function testCommentTypeEditing() {
$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 @@ public function testCommentAdminPostUpdateHook() {
/** @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 @@ public function testCommentWizard() {
// 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 @@ public function testLinkApprove() {
// 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 @@ public function testLinkApprove() {
$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 @@ public function testLinkReply() {
// 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 @@ public function testLinkReply() {
$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 @@ public function testConfigDependencyDeleteFormTrait() {
$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 @@ public function testConfigDependencyDeleteFormTrait() {
$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 @@ public function testList() {
$controller = \Drupal::entityTypeManager()->getListBuilder('config_test');