From a02891d1eadf08e16a31f6dff96ba1af570b098e Mon Sep 17 00:00:00 2001 From: catch Date: Fri, 8 Nov 2019 13:55:28 +0000 Subject: [PATCH] =?UTF-8?q?Issue=20#2742585=20by=20ZeiP,=20alexpott,=20mon?= =?UTF-8?q?drake,=20klausi,=20tomasnagy,=20Krzysztof=20Doma=C5=84ski,=20so?= =?UTF-8?q?kru,=20kristiaanvandeneynde,=20dawehner,=20jeroenbegyn:=20Depre?= =?UTF-8?q?cate=20dangerous=20assertTrue/False()=20compatibility=20overrid?= =?UTF-8?q?es=20in=20PHPUnit=20Kernel,=20Functional=20and=20FunctionalJava?= =?UTF-8?q?script=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Functional/ActionUninstallTest.php | 2 +- .../src/Functional/ConfigurationTest.php | 2 +- .../src/Functional/AggregatorTestBase.php | 4 +- .../Migrate/d7/MigrateAggregatorFeedTest.php | 2 +- .../src/Functional/IpAddressBlockingTest.php | 4 +- .../tests/src/Functional/BasicAuthTest.php | 4 +- .../tests/src/Functional/BlockUiTest.php | 4 +- .../src/Functional/Views/DisplayBlockTest.php | 12 +++--- .../tests/src/Kernel/BlockStorageUnitTest.php | 2 +- .../tests/src/Kernel/BlockViewBuilderTest.php | 6 +-- .../Functional/BlockContentCreationTest.php | 6 +-- .../src/Functional/BlockContentListTest.php | 2 +- .../Functional/BlockContentListViewsTest.php | 2 +- .../src/Functional/BlockContentSaveTest.php | 2 +- .../src/Functional/BlockContentTypeTest.php | 4 +- .../tests/src/Functional/PageEditTest.php | 2 +- .../Functional/BookContentModerationTest.php | 2 +- .../src/Functional/CKEditorAdminTest.php | 8 ++-- .../tests/src/Functional/CommentCSSTest.php | 12 +++--- .../src/Functional/CommentFieldsTest.php | 4 +- .../src/Functional/CommentInterfaceTest.php | 6 +-- .../src/Functional/CommentNodeChangesTest.php | 4 +- .../src/Functional/CommentNonNodeTest.php | 2 +- .../tests/src/Functional/CommentTestBase.php | 2 +- .../tests/src/Functional/CommentTitleTest.php | 2 +- .../tests/src/Functional/CommentTypeTest.php | 8 ++-- .../Update/CommentAdminViewUpdateTest.php | 2 +- .../tests/src/Functional/Views/WizardTest.php | 4 +- .../src/Kernel/Views/CommentLinksTest.php | 8 ++-- .../Functional/ConfigDependencyWebTest.php | 8 ++-- .../src/Functional/ConfigEntityListTest.php | 7 ++-- .../tests/src/Functional/ConfigEntityTest.php | 9 ++-- .../src/Functional/ConfigImportUITest.php | 4 +- .../src/Functional/ConfigInstallWebTest.php | 3 +- .../src/Functional/ConfigOtherModuleTest.php | 20 ++++----- .../Functional/ConfigTranslationUiTest.php | 6 +-- .../src/Functional/ContactPersonalTest.php | 4 +- .../src/Functional/ContactSitewideTest.php | 14 +++---- .../Functional/Update/ContactUpdateTest.php | 2 +- .../src/Functional/Views/ContactLinkTest.php | 2 +- .../src/Kernel/Views/ContactFieldsTest.php | 2 +- .../src/Functional/ModerationFormTest.php | 24 +++++------ .../src/Kernel/ContentModerationStateTest.php | 6 +-- .../ContentTranslationLinkTagTest.php | 2 +- .../ContentTranslationSettingsTest.php | 4 +- .../ContentTranslationSyncImageTest.php | 2 +- .../ContentTranslationUITestBase.php | 8 ++-- .../dblog/tests/src/Functional/DbLogTest.php | 10 ++--- .../src/Kernel/ConnectionFailureTest.php | 2 +- .../DynamicPageCacheIntegrationTest.php | 14 +++---- .../tests/src/Functional/EditorAdminTest.php | 2 +- .../src/Functional/EditorDialogAccessTest.php | 8 ++-- .../EntityReferenceAutoCreateTest.php | 4 +- .../EntityReferenceIntegrationTest.php | 2 +- .../FieldImportDeleteUninstallUiTest.php | 2 +- .../tests/src/Functional/NestedFormTest.php | 4 +- .../field/tests/src/Kernel/BulkDeleteTest.php | 6 +-- .../src/Kernel/FieldAttachStorageTest.php | 8 ++-- .../field/tests/src/Kernel/FieldCrudTest.php | 12 +++--- .../src/Kernel/FieldImportCreateTest.php | 42 ++++++++++--------- .../src/Kernel/FieldImportDeleteTest.php | 10 ++--- .../Kernel/FieldImportDeleteUninstallTest.php | 2 +- .../tests/src/Kernel/FieldStorageCrudTest.php | 2 +- .../d6/MigrateFieldWidgetSettingsTest.php | 2 +- .../src/Kernel/String/UuidFormatterTest.php | 6 +-- .../Kernel/Views/HandlerFieldFieldTest.php | 2 +- .../Functional/ManageFieldsFunctionalTest.php | 18 ++++---- .../tests/src/Kernel/EntityDisplayTest.php | 10 ++--- .../src/Kernel/EntityFormDisplayTest.php | 10 ++--- .../tests/src/Functional/DownloadTest.php | 2 +- .../src/Functional/FileFieldPathTest.php | 2 +- .../src/Functional/FileFieldTestBase.php | 2 +- .../tests/src/Functional/FileListingTest.php | 3 +- .../tests/src/Functional/FilePrivateTest.php | 8 ++-- .../src/Functional/SaveUploadFormTest.php | 4 +- .../tests/src/Functional/SaveUploadTest.php | 4 +- .../file/tests/src/Kernel/CopyTest.php | 6 +-- .../file/tests/src/Kernel/DeleteTest.php | 12 +++--- .../file/tests/src/Kernel/LoadTest.php | 2 +- .../file/tests/src/Kernel/MoveTest.php | 8 ++-- .../file/tests/src/Kernel/SaveDataTest.php | 8 ++-- .../tests/src/Functional/FilterAdminTest.php | 2 +- .../src/Kernel/FilterDefaultConfigTest.php | 2 +- .../src/Functional/ImageAdminStylesTest.php | 4 +- .../src/Functional/ImageFieldDisplayTest.php | 4 +- .../QuickEditImageControllerTest.php | 4 +- .../ImageAdminStylesTest.php | 2 +- .../JsonApiFunctionalMultilingualTest.php | 2 +- ...uageBrowserDetectionAcceptLanguageTest.php | 12 +++--- .../LanguageConfigurationElementTest.php | 4 +- .../LanguageUILanguageNegotiationTest.php | 4 +- .../LocaleConfigTranslationTest.php | 18 ++++---- .../Functional/LocaleImportFunctionalTest.php | 2 +- .../tests/src/Functional/LocaleUpdateBase.php | 2 +- .../Functional/LocaleUpdateInterfaceTest.php | 2 +- .../tests/src/Functional/LocaleUpdateTest.php | 2 +- .../tests/src/Kernel/LocaleStringTest.php | 8 ++-- .../src/Functional/MediaUiFunctionalTest.php | 2 +- .../MediaViewsWizardTest.php | 4 +- .../EmbeddedFormWidgetTest.php | 10 ++--- .../FunctionalJavascript/MediaLibraryTest.php | 2 +- .../Functional/MenuLinkContentFormTest.php | 2 +- .../Kernel/Migrate/d7/MigrateMenuLinkTest.php | 2 +- .../tests/src/Functional/MenuUiNodeTest.php | 2 +- .../tests/src/Functional/MenuUiTest.php | 7 ++-- .../src/Functional/MenuUninstallTest.php | 2 +- .../Kernel/MigrateEntityContentBaseTest.php | 4 +- .../MigrateRollbackEntityConfigTest.php | 4 +- .../tests/src/Kernel/MigrateRollbackTest.php | 4 +- .../src/Tests/StubTestTrait.php | 2 +- .../Functional/NodeAccessBaseTableTest.php | 6 +-- .../src/Functional/NodeAccessPagerTest.php | 4 +- .../NodeAccessRebuildNodeGrantsTest.php | 8 ++-- .../NodeActionsConfigurationTest.php | 2 +- .../Functional/NodeBlockFunctionalTest.php | 2 +- .../tests/src/Functional/NodeCreationTest.php | 2 +- .../tests/src/Functional/NodeEditFormTest.php | 2 +- .../Functional/NodeFieldMultilingualTest.php | 6 +-- .../tests/src/Functional/NodeSaveTest.php | 4 +- .../NodeTypeInitialLanguageTest.php | 2 +- .../tests/src/Functional/NodeViewTest.php | 6 +-- .../tests/src/Functional/PageViewTest.php | 2 +- .../src/Functional/Views/BulkFormTest.php | 2 +- .../src/Functional/Views/FrontPageTest.php | 2 +- .../Views/NodeRevisionWizardTest.php | 6 +-- .../Kernel/Config/NodeImportCreateTest.php | 10 ++--- .../src/Kernel/Migrate/d7/MigrateNodeTest.php | 4 +- .../src/Kernel/NodeAccessRecordsTest.php | 8 ++-- .../src/Kernel/NodeBodyFieldStorageTest.php | 4 +- .../tests/src/Kernel/SummaryLengthTest.php | 2 +- .../OptionsSelectDynamicValuesTest.php | 2 +- .../src/Functional/OptionsWidgetsTest.php | 14 +++---- .../tests/src/Functional/PageCacheTest.php | 20 ++++----- .../tests/src/Functional/PathAliasTest.php | 6 +-- .../tests/src/Functional/PathLanguageTest.php | 2 +- .../QuickEditCustomPipelineTest.php | 6 +-- .../QuickEditJavascriptTestBase.php | 2 +- .../src/Kernel/Field/NumberFieldRdfaTest.php | 16 +++---- .../Functional/ResponsiveImageAdminUITest.php | 2 +- .../Kernel/ResponsiveImageIntegrationTest.php | 2 +- .../Functional/Views/StyleSerializerTest.php | 8 ++-- .../tests/src/Kernel/Views/RestExportTest.php | 2 +- .../SearchConfigSettingsFormTest.php | 4 +- .../src/Functional/SearchRankingTest.php | 6 +-- .../tests/src/Functional/ShortcutSetsTest.php | 2 +- .../src/Functional/StatisticsAdminTest.php | 6 +-- .../src/Functional/Batch/ProcessingTest.php | 2 +- .../tests/src/Functional/Cache/ClearTest.php | 2 +- .../tests/src/Functional/Common/UrlTest.php | 2 +- .../Entity/EntityCacheTagsTestBase.php | 2 +- .../src/Functional/Entity/EntityFormTest.php | 12 +++--- .../Entity/EntityTranslationFormTest.php | 3 +- .../Entity/EntityViewControllerTest.php | 4 +- .../tests/src/Functional/Form/ElementTest.php | 12 +++--- .../Form/ElementsTableSelectTest.php | 10 ++--- .../tests/src/Functional/Form/FormTest.php | 7 ++-- .../Form/ModulesListFormWebTest.php | 2 +- .../Functional/Form/SystemConfigFormTest.php | 2 +- .../src/Functional/Mail/HtmlToTextTest.php | 5 +-- .../src/Functional/Menu/LocalTasksTest.php | 4 +- .../src/Functional/Module/DependencyTest.php | 2 +- .../Module/InstallUninstallTest.php | 8 ++-- .../src/Functional/Module/ModuleTestBase.php | 10 ++--- .../src/Functional/Module/UninstallTest.php | 2 +- .../tests/src/Functional/Pager/PagerTest.php | 16 +++---- .../Session/SessionAuthenticationTest.php | 2 +- .../Functional/Session/SessionHttpsTest.php | 2 +- .../src/Functional/Session/SessionTest.php | 10 ++--- .../tests/src/Functional/System/AdminTest.php | 6 +-- .../src/Functional/System/DateTimeTest.php | 2 +- .../Functional/System/ErrorHandlerTest.php | 4 +- .../src/Functional/Theme/TwigTransTest.php | 2 +- ...dateAddRevisionTranslationAffectedTest.php | 2 +- .../InstallProfileSystemInstall8300Test.php | 2 +- ...sAndTasksConvertedIntoBlocksUpdateTest.php | 2 +- .../Functional/Update/RebuildScriptTest.php | 2 +- ...LocalTasksConvertedIntoBlockUpdateTest.php | 2 +- .../Functional/Update/UpdateScriptTest.php | 2 +- .../Migrate/d7/MigrateThemeSettingsTest.php | 4 +- .../tests/src/Kernel/System/CronQueueTest.php | 4 +- .../tests/src/Functional/LoadMultipleTest.php | 2 +- .../tests/src/Functional/TermTest.php | 10 ++--- .../tests/src/Functional/VocabularyUiTest.php | 6 +-- .../Migrate/MigrateTaxonomyTermStubTest.php | 4 +- .../src/Functional/ToolbarAdminMenuTest.php | 14 +++---- .../Update/UserUpdateEmailToken.php | 4 +- .../src/Functional/UserAdminListingTest.php | 2 +- .../tests/src/Functional/UserAdminTest.php | 4 +- .../tests/src/Functional/UserCancelTest.php | 23 +++++----- .../src/Functional/UserPasswordResetTest.php | 4 +- .../tests/src/Functional/UserPictureTest.php | 2 +- .../src/Functional/UserRegistrationTest.php | 4 +- .../src/Functional/UserRoleAdminTest.php | 2 +- .../CurrentUserContextTest.php | 2 +- .../Migrate/d6/MigrateUserPictureFileTest.php | 2 +- .../src/Kernel/Migrate/d6/MigrateUserTest.php | 2 +- .../src/Kernel/TempStoreDatabaseTest.php | 4 +- .../tests/src/Kernel/UserMailNotifyTest.php | 2 +- .../Views/HandlerArgumentUserUidTest.php | 2 +- .../src/Tests/AssertViewsCacheTagsTrait.php | 8 ++-- .../tests/src/Functional/BulkFormTest.php | 4 +- .../tests/src/Functional/GlossaryTest.php | 2 +- .../tests/src/Functional/Handler/AreaTest.php | 2 +- .../src/Functional/Handler/FieldWebTest.php | 40 +++++++++--------- .../src/Functional/Handler/HandlerTest.php | 6 +-- .../Functional/Plugin/ArgumentDefaultTest.php | 4 +- .../src/Functional/Plugin/CacheTagTest.php | 14 +++---- .../src/Functional/Plugin/CacheWebTest.php | 4 +- .../src/Functional/Plugin/DisplayFeedTest.php | 4 +- .../Functional/Plugin/DisplayPageWebTest.php | 2 +- .../src/Functional/Plugin/DisplayTest.php | 6 +-- .../src/Functional/Plugin/ExposedFormTest.php | 4 +- .../src/Functional/Plugin/StyleTableTest.php | 24 +++++------ .../tests/src/Functional/ViewElementTest.php | 8 ++-- .../Handler/GroupedExposedFilterTest.php | 12 +++--- .../Entity/LatestRevisionFilterTest.php | 2 +- .../src/Kernel/Handler/AreaTitleTest.php | 2 +- .../src/Kernel/Handler/FieldCustomTest.php | 2 +- .../tests/src/Kernel/Plugin/CacheTest.php | 2 +- .../Plugin/Display/ViewsMenuLinkTest.php | 24 +++++------ .../tests/src/Kernel/Plugin/QueryTest.php | 6 +-- .../src/Kernel/Plugin/RowRenderCacheTest.php | 2 +- .../tests/src/Kernel/Plugin/StyleGridTest.php | 10 ++--- .../tests/src/Kernel/QueryGroupByTest.php | 6 +-- .../src/Kernel/RenderCacheIntegrationTest.php | 4 +- .../tests/src/Kernel/ViewElementTest.php | 4 +- .../tests/src/Kernel/ViewExecutableTest.php | 4 +- .../tests/src/Kernel/ViewStorageTest.php | 2 +- .../tests/src/Functional/AnalyzeTest.php | 6 +-- .../src/Functional/CustomBooleanTest.php | 20 ++++----- .../tests/src/Functional/DisplayCRUDTest.php | 4 +- .../tests/src/Functional/DisplayTest.php | 16 +++---- .../tests/src/Functional/PreviewTest.php | 2 +- .../tests/src/Functional/UITestBase.php | 2 +- .../src/FunctionalJavascript/PreviewTest.php | 30 ++++++------- .../Functional/WorkspaceCacheContextTest.php | 4 +- .../Core/Form/FormGroupingElementsTest.php | 4 +- .../FunctionalTests/BrowserTestBaseTest.php | 2 +- .../BrowserTestBaseUserAgentTest.php | 2 +- .../Core/Asset/AttachedAssetsTest.php | 2 +- .../Asset/LibraryDiscoveryIntegrationTest.php | 4 +- .../Core/Cache/DatabaseBackendTagTest.php | 2 +- .../Cache/GenericCacheBackendUnitTestBase.php | 18 ++++---- .../KernelTests/Core/Command/DbDumpTest.php | 10 ++--- .../Core/Config/ConfigDependencyTest.php | 30 ++++++------- .../Core/Config/ConfigFileContentTest.php | 6 +-- .../Core/Config/ConfigImporterTest.php | 12 +++--- .../Core/Config/ConfigInstallTest.php | 2 +- .../KernelTests/Core/Database/QueryTest.php | 4 +- .../Core/Entity/ContentEntityChangedTest.php | 8 ++-- .../Core/Entity/EntityFieldTest.php | 9 ++-- .../Core/Entity/EntityQueryTest.php | 2 +- .../Core/Entity/EntityTranslationTest.php | 8 ++-- .../Core/Entity/EntityUUIDTest.php | 2 +- .../Core/Entity/EntityViewBuilderTest.php | 8 ++-- .../ValidReferenceConstraintValidatorTest.php | 6 +-- .../KernelTests/Core/File/FileCopyTest.php | 10 ++--- .../KernelTests/Core/File/FileMoveTest.php | 8 ++-- .../Core/File/FileSaveDataTest.php | 2 +- .../Core/File/ReadOnlyStreamWrapperTest.php | 8 ++-- .../Core/File/StreamWrapperTest.php | 12 +++--- .../KernelTests/Core/Form/FormCacheTest.php | 12 +++--- .../DatabaseStorageExpirableTest.php | 18 ++++---- .../KeyValueContentEntityStorageTest.php | 8 ++-- .../Core/KeyValueStore/StorageTestBase.php | 22 +++++----- .../Core/Menu/MenuTreeStorageTest.php | 2 +- .../Render/Element/RenderElementTypesTest.php | 6 +-- .../Core/Routing/RouteProviderTest.php | 4 +- .../Core/TempStore/TempStoreDatabaseTest.php | 4 +- .../KernelTests/Core/Theme/RegistryTest.php | 10 ++--- .../Core/Theme/ThemeInstallerTest.php | 26 ++++++------ .../PhpUnit6/TestCompatibilityTrait.php | 2 + .../PhpUnit7/TestCompatibilityTrait.php | 2 + .../Assert/KernelAssertLegacyTraitTest.php | 31 ++++++++++++++ 274 files changed, 851 insertions(+), 820 deletions(-) create mode 100644 core/tests/Drupal/Tests/Core/Assert/KernelAssertLegacyTraitTest.php diff --git a/core/modules/action/tests/src/Functional/ActionUninstallTest.php b/core/modules/action/tests/src/Functional/ActionUninstallTest.php index 5e3718044e5..58e652b791c 100644 --- a/core/modules/action/tests/src/Functional/ActionUninstallTest.php +++ b/core/modules/action/tests/src/Functional/ActionUninstallTest.php @@ -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); diff --git a/core/modules/action/tests/src/Functional/ConfigurationTest.php b/core/modules/action/tests/src/Functional/ConfigurationTest.php index 06510ecc80a..05421b7b0d0 100644 --- a/core/modules/action/tests/src/Functional/ConfigurationTest.php +++ b/core/modules/action/tests/src/Functional/ConfigurationTest.php @@ -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.'); } } diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php b/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php index b4c80d0bd3a..baac8f69bf8 100644 --- a/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php +++ b/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php @@ -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); } /** diff --git a/core/modules/aggregator/tests/src/Kernel/Migrate/d7/MigrateAggregatorFeedTest.php b/core/modules/aggregator/tests/src/Kernel/Migrate/d7/MigrateAggregatorFeedTest.php index fd208238c77..401ea048fe4 100644 --- a/core/modules/aggregator/tests/src/Kernel/Migrate/d7/MigrateAggregatorFeedTest.php +++ b/core/modules/aggregator/tests/src/Kernel/Migrate/d7/MigrateAggregatorFeedTest.php @@ -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()); } diff --git a/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php b/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php index bb77517e40b..344678c30e9 100644 --- a/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php +++ b/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php @@ -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 diff --git a/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php b/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php index 55b7fc15ead..16446ad3322 100644 --- a/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php +++ b/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php @@ -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.'); } diff --git a/core/modules/block/tests/src/Functional/BlockUiTest.php b/core/modules/block/tests/src/Functional/BlockUiTest.php index a3fc1bb180b..7e98e70938d 100644 --- a/core/modules/block/tests/src/Functional/BlockUiTest.php +++ b/core/modules/block/tests/src/Functional/BlockUiTest.php @@ -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.'); } /** diff --git a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php index 77bb711b72a..211847c5d00 100644 --- a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php +++ b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php @@ -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); diff --git a/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php b/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php index 4b13f9c6dd5..09abf2ad3ae 100644 --- a/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php +++ b/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php @@ -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()); } /** diff --git a/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php b/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php index 95a444deded..a70e89c3183 100644 --- a/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php +++ b/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php @@ -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']); diff --git a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php index 5bfd624e5ca..7f3b2513811 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php @@ -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.'); } /** diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php index ae56cda1fc1..61edfdaefd7 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php @@ -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'); diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php index ca896c613f9..61f29847185 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php @@ -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'); diff --git a/core/modules/block_content/tests/src/Functional/BlockContentSaveTest.php b/core/modules/block_content/tests/src/Functional/BlockContentSaveTest.php index 5b89d4d1b94..b62ea413d84 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentSaveTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentSaveTest.php @@ -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']); } diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php index 2e172551318..9a8f6b59642 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php @@ -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); diff --git a/core/modules/block_content/tests/src/Functional/PageEditTest.php b/core/modules/block_content/tests/src/Functional/PageEditTest.php index 1cc8c1946ca..fc39ab44b30 100644 --- a/core/modules/block_content/tests/src/Functional/PageEditTest.php +++ b/core/modules/block_content/tests/src/Functional/PageEditTest.php @@ -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()); diff --git a/core/modules/book/tests/src/Functional/BookContentModerationTest.php b/core/modules/book/tests/src/Functional/BookContentModerationTest.php index 00c234dafa1..6a1ce9c78b2 100644 --- a/core/modules/book/tests/src/Functional/BookContentModerationTest.php +++ b/core/modules/book/tests/src/Functional/BookContentModerationTest.php @@ -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', diff --git a/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php index 87c358cd684..26b71553ece 100644 --- a/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php +++ b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php @@ -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"