diff --git a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php index fa409af..e3090e2 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php @@ -70,7 +70,7 @@ public function testLibraryUnknown() { $build['#attached']['library'][] = 'core/unknown'; $assets = AttachedAssets::createFromRenderArray($build); - $this->assertIdentical([], $this->assetResolver->getJsAssets($assets, FALSE)[0], 'Unknown library was not added to the page.'); + $this->assertSame([], $this->assetResolver->getJsAssets($assets, FALSE)[0], 'Unknown library was not added to the page.'); } /** @@ -210,17 +210,17 @@ public function testSettings() { // Test whether the settings for core/drupalSettings are available. $this->assertTrue(isset($parsed_settings['path']['baseUrl']), 'drupalSettings.path.baseUrl is present.'); - $this->assertIdentical($parsed_settings['path']['pathPrefix'], 'yarhar', 'drupalSettings.path.pathPrefix is present and has the correct (overridden) value.'); - $this->assertIdentical($parsed_settings['path']['currentPath'], '', 'drupalSettings.path.currentPath is present and has the correct value.'); - $this->assertIdentical($parsed_settings['path']['currentPathIsAdmin'], FALSE, 'drupalSettings.path.currentPathIsAdmin is present and has the correct value.'); - $this->assertIdentical($parsed_settings['path']['isFront'], FALSE, 'drupalSettings.path.isFront is present and has the correct value.'); - $this->assertIdentical($parsed_settings['path']['currentLanguage'], 'en', 'drupalSettings.path.currentLanguage is present and has the correct value.'); + $this->assertSame($parsed_settings['path']['pathPrefix'], 'yarhar', 'drupalSettings.path.pathPrefix is present and has the correct (overridden) value.'); + $this->assertSame($parsed_settings['path']['currentPath'], '', 'drupalSettings.path.currentPath is present and has the correct value.'); + $this->assertSame($parsed_settings['path']['currentPathIsAdmin'], FALSE, 'drupalSettings.path.currentPathIsAdmin is present and has the correct value.'); + $this->assertSame($parsed_settings['path']['isFront'], FALSE, 'drupalSettings.path.isFront is present and has the correct value.'); + $this->assertSame($parsed_settings['path']['currentLanguage'], 'en', 'drupalSettings.path.currentLanguage is present and has the correct value.'); // Tests whether altering JavaScript settings via hook_js_settings_alter() // is working as expected. // @see common_test_js_settings_alter() - $this->assertIdentical($parsed_settings['pluralDelimiter'], '☃'); - $this->assertIdentical($parsed_settings['foo'], 'bar'); + $this->assertSame($parsed_settings['pluralDelimiter'], '☃'); + $this->assertSame($parsed_settings['foo'], 'bar'); } /** @@ -318,7 +318,7 @@ public function testRenderOrder() { else { $result = []; } - $this->assertIdentical($result, $expected_order_js, 'JavaScript is added in the expected weight order.'); + $this->assertSame($result, $expected_order_js, 'JavaScript is added in the expected weight order.'); // Construct the expected result from the regex. $expected_order_css = [ @@ -360,7 +360,7 @@ public function testRenderOrder() { else { $result = []; } - $this->assertIdentical($result, $expected_order_css, 'CSS is added in the expected weight order.'); + $this->assertSame($result, $expected_order_css, 'CSS is added in the expected weight order.'); } /** @@ -435,12 +435,12 @@ public function testDynamicLibrary() { $dynamic_library = $library_discovery->getLibraryByName('common_test', 'dynamic_library'); $this->assertTrue(is_array($dynamic_library)); if ($this->assertTrue(isset($dynamic_library['version']))) { - $this->assertIdentical('1.0', $dynamic_library['version']); + $this->assertSame('1.0', $dynamic_library['version']); } // Make sure the dynamic library definition could be altered. // @see common_test_library_info_alter() if ($this->assertTrue(isset($dynamic_library['dependencies']))) { - $this->assertIdentical(['core/jquery'], $dynamic_library['dependencies']); + $this->assertSame(['core/jquery'], $dynamic_library['dependencies']); } } diff --git a/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php b/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php index 4c54487..4d2347f 100644 --- a/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php +++ b/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php @@ -36,18 +36,18 @@ public function testDrupalGetFilename() { system_rebuild_module_data(); // Retrieving the location of a module. - $this->assertIdentical(drupal_get_filename('module', 'system'), 'core/modules/system/system.info.yml'); + $this->assertSame(drupal_get_filename('module', 'system'), 'core/modules/system/system.info.yml'); // Retrieving the location of a theme. \Drupal::service('theme_handler')->install(['stark']); - $this->assertIdentical(drupal_get_filename('theme', 'stark'), 'core/themes/stark/stark.info.yml'); + $this->assertSame(drupal_get_filename('theme', 'stark'), 'core/themes/stark/stark.info.yml'); // Retrieving the location of a theme engine. - $this->assertIdentical(drupal_get_filename('theme_engine', 'twig'), 'core/themes/engines/twig/twig.info.yml'); + $this->assertSame(drupal_get_filename('theme_engine', 'twig'), 'core/themes/engines/twig/twig.info.yml'); // Retrieving the location of a profile. Profiles are a special case with // a fixed location and naming. - $this->assertIdentical(drupal_get_filename('profile', 'testing'), 'core/profiles/testing/testing.info.yml'); + $this->assertSame(drupal_get_filename('profile', 'testing'), 'core/profiles/testing/testing.info.yml'); // Generate a non-existing module name. diff --git a/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php b/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php index de8bbda..04bbdc6 100644 --- a/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php +++ b/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php @@ -40,12 +40,12 @@ public function testSetGet() { $cid_long = str_repeat('愛€', 500); $cached_value_long = $this->randomMachineName(); $backend->set($cid_long, $cached_value_long); - $this->assertIdentical($cached_value_long, $backend->get($cid_long)->data, "Backend contains the correct value for long, non-ASCII cache id."); + $this->assertSame($cached_value_long, $backend->get($cid_long)->data, "Backend contains the correct value for long, non-ASCII cache id."); $cid_short = '愛1€'; $cached_value_short = $this->randomMachineName(); $backend->set($cid_short, $cached_value_short); - $this->assertIdentical($cached_value_short, $backend->get($cid_short)->data, "Backend contains the correct value for short, non-ASCII cache id."); + $this->assertSame($cached_value_short, $backend->get($cid_short)->data, "Backend contains the correct value for short, non-ASCII cache id."); } } diff --git a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php index 4e57a71..29f26b7 100644 --- a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php @@ -130,22 +130,22 @@ protected function tearDown() { public function testSetGet() { $backend = $this->getCacheBackend(); - $this->assertIdentical(FALSE, $backend->get('test1'), "Backend does not contain data for cache id test1."); + $this->assertSame(FALSE, $backend->get('test1'), "Backend does not contain data for cache id test1."); $with_backslash = ['foo' => '\Drupal\foo\Bar']; $backend->set('test1', $with_backslash); $cached = $backend->get('test1'); $this->assert(is_object($cached), "Backend returned an object for cache id test1."); - $this->assertIdentical($with_backslash, $cached->data); + $this->assertSame($with_backslash, $cached->data); $this->assertTrue($cached->valid, 'Item is marked as valid.'); // We need to round because microtime may be rounded up in the backend. $this->assertTrue($cached->created >= REQUEST_TIME && $cached->created <= round(microtime(TRUE), 3), 'Created time is correct.'); $this->assertEqual($cached->expire, Cache::PERMANENT, 'Expire time is correct.'); - $this->assertIdentical(FALSE, $backend->get('test2'), "Backend does not contain data for cache id test2."); + $this->assertSame(FALSE, $backend->get('test2'), "Backend does not contain data for cache id test2."); $backend->set('test2', ['value' => 3], REQUEST_TIME + 3); $cached = $backend->get('test2'); $this->assert(is_object($cached), "Backend returned an object for cache id test2."); - $this->assertIdentical(['value' => 3], $cached->data); + $this->assertSame(['value' => 3], $cached->data); $this->assertTrue($cached->valid, 'Item is marked as valid.'); $this->assertTrue($cached->created >= REQUEST_TIME && $cached->created <= round(microtime(TRUE), 3), 'Created time is correct.'); $this->assertEqual($cached->expire, REQUEST_TIME + 3, 'Expire time is correct.'); @@ -158,22 +158,22 @@ public function testSetGet() { $this->assertTrue($cached->created >= REQUEST_TIME && $cached->created <= round(microtime(TRUE), 3), 'Created time is correct.'); $this->assertEqual($cached->expire, REQUEST_TIME - 3, 'Expire time is correct.'); - $this->assertIdentical(FALSE, $backend->get('test4'), "Backend does not contain data for cache id test4."); + $this->assertSame(FALSE, $backend->get('test4'), "Backend does not contain data for cache id test4."); $with_eof = ['foo' => "\nEOF\ndata"]; $backend->set('test4', $with_eof); $cached = $backend->get('test4'); $this->assert(is_object($cached), "Backend returned an object for cache id test4."); - $this->assertIdentical($with_eof, $cached->data); + $this->assertSame($with_eof, $cached->data); $this->assertTrue($cached->valid, 'Item is marked as valid.'); $this->assertTrue($cached->created >= REQUEST_TIME && $cached->created <= round(microtime(TRUE), 3), 'Created time is correct.'); $this->assertEqual($cached->expire, Cache::PERMANENT, 'Expire time is correct.'); - $this->assertIdentical(FALSE, $backend->get('test5'), "Backend does not contain data for cache id test5."); + $this->assertSame(FALSE, $backend->get('test5'), "Backend does not contain data for cache id test5."); $with_eof_and_semicolon = ['foo' => "\nEOF;\ndata"]; $backend->set('test5', $with_eof_and_semicolon); $cached = $backend->get('test5'); $this->assert(is_object($cached), "Backend returned an object for cache id test5."); - $this->assertIdentical($with_eof_and_semicolon, $cached->data); + $this->assertSame($with_eof_and_semicolon, $cached->data); $this->assertTrue($cached->valid, 'Item is marked as valid.'); $this->assertTrue($cached->created >= REQUEST_TIME && $cached->created <= round(microtime(TRUE), 3), 'Created time is correct.'); $this->assertEqual($cached->expire, Cache::PERMANENT, 'Expire time is correct.'); @@ -182,7 +182,7 @@ public function testSetGet() { $backend->set('test6', $with_variable); $cached = $backend->get('test6'); $this->assert(is_object($cached), "Backend returned an object for cache id test6."); - $this->assertIdentical($with_variable, $cached->data); + $this->assertSame($with_variable, $cached->data); // Make sure that a cached object is not affected by changing the original. $data = new \stdClass(); @@ -229,26 +229,26 @@ public function testSetGet() { public function testDelete() { $backend = $this->getCacheBackend(); - $this->assertIdentical(FALSE, $backend->get('test1'), "Backend does not contain data for cache id test1."); + $this->assertSame(FALSE, $backend->get('test1'), "Backend does not contain data for cache id test1."); $backend->set('test1', 7); $this->assert(is_object($backend->get('test1')), "Backend returned an object for cache id test1."); - $this->assertIdentical(FALSE, $backend->get('test2'), "Backend does not contain data for cache id test2."); + $this->assertSame(FALSE, $backend->get('test2'), "Backend does not contain data for cache id test2."); $backend->set('test2', 3); $this->assert(is_object($backend->get('test2')), "Backend returned an object for cache id %cid."); $backend->delete('test1'); - $this->assertIdentical(FALSE, $backend->get('test1'), "Backend does not contain data for cache id test1 after deletion."); + $this->assertSame(FALSE, $backend->get('test1'), "Backend does not contain data for cache id test1 after deletion."); $this->assert(is_object($backend->get('test2')), "Backend still has an object for cache id test2."); $backend->delete('test2'); - $this->assertIdentical(FALSE, $backend->get('test2'), "Backend does not contain data for cache id test2 after deletion."); + $this->assertSame(FALSE, $backend->get('test2'), "Backend does not contain data for cache id test2 after deletion."); $long_cid = str_repeat('a', 300); $backend->set($long_cid, 'test'); $backend->delete($long_cid); - $this->assertIdentical(FALSE, $backend->get($long_cid), "Backend does not contain data for long cache id after deletion."); + $this->assertSame(FALSE, $backend->get($long_cid), "Backend does not contain data for long cache id after deletion."); } /** @@ -275,7 +275,7 @@ public function testValueTypeIsKept() { foreach ($variables as $cid => $value) { $object = $backend->get($cid); $this->assert(is_object($object), sprintf("Backend returned an object for cache id %s.", $cid)); - $this->assertIdentical($value, $object->data, sprintf("Data of cached id %s kept is identical in type and value", $cid)); + $this->assertSame($value, $object->data, sprintf("Data of cached id %s kept is identical in type and value", $cid)); } } @@ -321,10 +321,10 @@ public function testGetMultiple() { $this->assertFalse(isset($ret['test19']), "Nonexistent cache id test19 is not set."); $this->assertFalse(isset($ret['test21']), "Nonexistent cache id test21 is not set."); // Test values. - $this->assertIdentical($ret['test2']->data, 3, "Existing cache id test2 has the correct value."); - $this->assertIdentical($ret['test3']->data, 5, "Existing cache id test3 has the correct value."); - $this->assertIdentical($ret['test6']->data, 13, "Existing cache id test6 has the correct value."); - $this->assertIdentical($ret['test7']->data, 17, "Existing cache id test7 has the correct value."); + $this->assertSame($ret['test2']->data, 3, "Existing cache id test2 has the correct value."); + $this->assertSame($ret['test3']->data, 5, "Existing cache id test3 has the correct value."); + $this->assertSame($ret['test6']->data, 13, "Existing cache id test6 has the correct value."); + $this->assertSame($ret['test7']->data, 17, "Existing cache id test7 has the correct value."); // Test $cids array - ensure it contains cache id's that do not exist. $this->assert(in_array('test19', $cids), "Nonexistent cache id test19 is in cids array."); $this->assert(in_array('test21', $cids), "Nonexistent cache id test21 is in cids array."); @@ -351,9 +351,9 @@ public function testGetMultiple() { $this->assertFalse(isset($ret['test6']), "Deleted cache id test6 is not set"); $this->assertFalse(isset($ret['test21']), "Nonexistent cache id test21 is not set"); // Test values. - $this->assertIdentical($ret['test2']->data, 3, "Existing cache id test2 has the correct value."); - $this->assertIdentical($ret['test7']->data, 17, "Existing cache id test7 has the correct value."); - $this->assertIdentical($ret['test19']->data, 57, "Added cache id test19 has the correct value."); + $this->assertSame($ret['test2']->data, 3, "Existing cache id test2 has the correct value."); + $this->assertSame($ret['test7']->data, 17, "Existing cache id test7 has the correct value."); + $this->assertSame($ret['test19']->data, 57, "Added cache id test19 has the correct value."); // Test $cids array - ensure it contains cache id's that do not exist. $this->assert(in_array('test3', $cids), "Deleted cache id test3 is in cids array."); $this->assert(in_array('test6', $cids), "Deleted cache id test6 is in cids array."); @@ -450,10 +450,10 @@ public function testDeleteMultiple() { ]); // Test if expected keys have been deleted. - $this->assertIdentical(FALSE, $backend->get('test1'), "Cache id test1 deleted."); - $this->assertIdentical(FALSE, $backend->get('test3'), "Cache id test3 deleted."); - $this->assertIdentical(FALSE, $backend->get('test5'), "Cache id test5 deleted."); - $this->assertIdentical(FALSE, $backend->get('test7'), "Cache id test7 deleted."); + $this->assertSame(FALSE, $backend->get('test1'), "Cache id test1 deleted."); + $this->assertSame(FALSE, $backend->get('test3'), "Cache id test3 deleted."); + $this->assertSame(FALSE, $backend->get('test5'), "Cache id test5 deleted."); + $this->assertSame(FALSE, $backend->get('test7'), "Cache id test7 deleted."); // Test if expected keys exist. $this->assertNotIdentical(FALSE, $backend->get('test2'), "Cache id test2 exists."); @@ -461,8 +461,8 @@ public function testDeleteMultiple() { $this->assertNotIdentical(FALSE, $backend->get('test6'), "Cache id test6 exists."); // Test if that expected keys do not exist. - $this->assertIdentical(FALSE, $backend->get('test19'), "Cache id test19 does not exist."); - $this->assertIdentical(FALSE, $backend->get('test21'), "Cache id test21 does not exist."); + $this->assertSame(FALSE, $backend->get('test19'), "Cache id test19 does not exist."); + $this->assertSame(FALSE, $backend->get('test21'), "Cache id test21 does not exist."); // Calling deleteMultiple() with an empty array should not cause an error. $this->assertFalse($backend->deleteMultiple([])); diff --git a/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php b/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php index 8129410..c6192da 100644 --- a/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php +++ b/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php @@ -205,13 +205,13 @@ public function testScriptLoad() { $this->assertTrue(Database::getConnection() ->schema() ->tableExists($table), SafeMarkup::format('Table @table created by the database script.', ['@table' => $table])); - $this->assertIdentical($this->originalTableSchemas[$table], $this->getTableSchema($table), SafeMarkup::format('The schema for @table was properly restored.', ['@table' => $table])); - $this->assertIdentical($this->originalTableIndexes[$table], $this->getTableIndexes($table), SafeMarkup::format('The indexes for @table were properly restored.', ['@table' => $table])); + $this->assertSame($this->originalTableSchemas[$table], $this->getTableSchema($table), SafeMarkup::format('The schema for @table was properly restored.', ['@table' => $table])); + $this->assertSame($this->originalTableIndexes[$table], $this->getTableIndexes($table), SafeMarkup::format('The indexes for @table were properly restored.', ['@table' => $table])); } // Ensure the test config has been replaced. $config = unserialize(db_query("SELECT data FROM {config} WHERE name = 'test_config'")->fetchField()); - $this->assertIdentical($config, $this->data, 'Script has properly restored the config table data.'); + $this->assertSame($config, $this->data, 'Script has properly restored the config table data.'); // Ensure the cache data was not exported. $this->assertFalse(\Drupal::cache('discovery') diff --git a/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php b/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php index 2375487..ceaa5ef 100644 --- a/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php @@ -48,9 +48,9 @@ public function testBadProtocolStripping() { $url = 'javascript:http://www.example.com/?x=1&y=2'; $expected_plain = 'http://www.example.com/?x=1&y=2'; $expected_html = 'http://www.example.com/?x=1&y=2'; - $this->assertIdentical(check_url($url), $expected_html, 'check_url() filters a URL and encodes it for HTML.'); - $this->assertIdentical(UrlHelper::filterBadProtocol($url), $expected_html, '\Drupal\Component\Utility\UrlHelper::filterBadProtocol() filters a URL and encodes it for HTML.'); - $this->assertIdentical(UrlHelper::stripDangerousProtocols($url), $expected_plain, '\Drupal\Component\Utility\UrlHelper::stripDangerousProtocols() filters a URL and returns plain text.'); + $this->assertSame(check_url($url), $expected_html, 'check_url() filters a URL and encodes it for HTML.'); + $this->assertSame(UrlHelper::filterBadProtocol($url), $expected_html, '\Drupal\Component\Utility\UrlHelper::filterBadProtocol() filters a URL and encodes it for HTML.'); + $this->assertSame(UrlHelper::stripDangerousProtocols($url), $expected_plain, '\Drupal\Component\Utility\UrlHelper::stripDangerousProtocols() filters a URL and returns plain text.'); } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php index a94b1b8..e2b1bb77 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php @@ -43,30 +43,30 @@ public function testCRUD() { $name = 'config_test.crud'; $config = $this->config($name); - $this->assertIdentical($config->isNew(), TRUE); + $this->assertSame($config->isNew(), TRUE); // Create a new configuration object. $config->set('value', 'initial'); $config->save(); - $this->assertIdentical($config->isNew(), FALSE); + $this->assertSame($config->isNew(), FALSE); // Verify the active configuration contains the saved value. $actual_data = $storage->read($name); - $this->assertIdentical($actual_data, ['value' => 'initial']); + $this->assertSame($actual_data, ['value' => 'initial']); // Update the configuration object instance. $config->set('value', 'instance-update'); $config->save(); - $this->assertIdentical($config->isNew(), FALSE); + $this->assertSame($config->isNew(), FALSE); // Verify the active configuration contains the updated value. $actual_data = $storage->read($name); - $this->assertIdentical($actual_data, ['value' => 'instance-update']); + $this->assertSame($actual_data, ['value' => 'instance-update']); // Verify a call to $this->config() immediately returns the updated value. $new_config = $this->config($name); - $this->assertIdentical($new_config->get(), $config->get()); - $this->assertIdentical($config->isNew(), FALSE); + $this->assertSame($new_config->get(), $config->get()); + $this->assertSame($config->isNew(), FALSE); // Pollute the config factory static cache. $config_factory->getEditable($name); @@ -75,48 +75,48 @@ public function testCRUD() { $config->delete(); // Verify the configuration object is empty. - $this->assertIdentical($config->get(), []); - $this->assertIdentical($config->isNew(), TRUE); + $this->assertSame($config->get(), []); + $this->assertSame($config->isNew(), TRUE); // Verify that all copies of the configuration has been removed from the // static cache. - $this->assertIdentical($config_factory->getEditable($name)->isNew(), TRUE); + $this->assertSame($config_factory->getEditable($name)->isNew(), TRUE); // Verify the active configuration contains no value. $actual_data = $storage->read($name); - $this->assertIdentical($actual_data, FALSE); + $this->assertSame($actual_data, FALSE); // Verify $this->config() returns no data. $new_config = $this->config($name); - $this->assertIdentical($new_config->get(), $config->get()); - $this->assertIdentical($config->isNew(), TRUE); + $this->assertSame($new_config->get(), $config->get()); + $this->assertSame($config->isNew(), TRUE); // Re-create the configuration object. $config->set('value', 're-created'); $config->save(); - $this->assertIdentical($config->isNew(), FALSE); + $this->assertSame($config->isNew(), FALSE); // Verify the active configuration contains the updated value. $actual_data = $storage->read($name); - $this->assertIdentical($actual_data, ['value' => 're-created']); + $this->assertSame($actual_data, ['value' => 're-created']); // Verify a call to $this->config() immediately returns the updated value. $new_config = $this->config($name); - $this->assertIdentical($new_config->get(), $config->get()); - $this->assertIdentical($config->isNew(), FALSE); + $this->assertSame($new_config->get(), $config->get()); + $this->assertSame($config->isNew(), FALSE); // Rename the configuration object. $new_name = 'config_test.crud_rename'; $this->container->get('config.factory')->rename($name, $new_name); $renamed_config = $this->config($new_name); - $this->assertIdentical($renamed_config->get(), $config->get()); - $this->assertIdentical($renamed_config->isNew(), FALSE); + $this->assertSame($renamed_config->get(), $config->get()); + $this->assertSame($renamed_config->isNew(), FALSE); // Ensure that the old configuration object is removed from both the cache // and the configuration storage. $config = $this->config($name); - $this->assertIdentical($config->get(), []); - $this->assertIdentical($config->isNew(), TRUE); + $this->assertSame($config->get(), []); + $this->assertSame($config->isNew(), TRUE); // Test renaming when config.factory does not have the object in its static // cache. @@ -129,12 +129,12 @@ public function testCRUD() { $new_name = 'config_test.crud_rename_no_cache'; $config_factory->rename($name, $new_name); $renamed_config = $config_factory->get($new_name); - $this->assertIdentical($renamed_config->get(), $config->get()); - $this->assertIdentical($renamed_config->isNew(), FALSE); + $this->assertSame($renamed_config->get(), $config->get()); + $this->assertSame($renamed_config->isNew(), FALSE); // Ensure the overrides static cache has been cleared. - $this->assertIdentical($config_factory->get($name)->isNew(), TRUE); + $this->assertSame($config_factory->get($name)->isNew(), TRUE); // Ensure the non-overrides static cache has been cleared. - $this->assertIdentical($config_factory->getEditable($name)->isNew(), TRUE); + $this->assertSame($config_factory->getEditable($name)->isNew(), TRUE); // Merge data into the configuration object. $new_config = $this->config($new_name); @@ -144,8 +144,8 @@ public function testCRUD() { ]; $new_config->merge($expected_values); $new_config->save(); - $this->assertIdentical($new_config->get('value'), $expected_values['value']); - $this->assertIdentical($new_config->get('404'), $expected_values['404']); + $this->assertSame($new_config->get('value'), $expected_values['value']); + $this->assertSame($new_config->get('404'), $expected_values['404']); // Test that getMultiple() does not return new config objects that were // previously accessed with get() @@ -260,30 +260,30 @@ public function testDataTypes() { 'string_int' => '1', ]; $data['_core']['default_config_hash'] = Crypt::hashBase64(serialize($data)); - $this->assertIdentical($config->get(), $data); + $this->assertSame($config->get(), $data); // Re-set each key using Config::set(). foreach ($data as $key => $value) { $config->set($key, $value); } $config->save(); - $this->assertIdentical($config->get(), $data); + $this->assertSame($config->get(), $data); // Assert the data against the file storage. - $this->assertIdentical($storage->read($name), $data); + $this->assertSame($storage->read($name), $data); $this->verbose('
' . $name . var_export($storage->read($name), TRUE)); // Set data using config::setData(). $config->setData($data)->save(); - $this->assertIdentical($config->get(), $data); - $this->assertIdentical($storage->read($name), $data); + $this->assertSame($config->get(), $data); + $this->assertSame($storage->read($name), $data); // Test that schema type enforcement can be overridden by trusting the data. - $this->assertIdentical(99, $config->get('int')); + $this->assertSame(99, $config->get('int')); $config->set('int', '99')->save(TRUE); - $this->assertIdentical('99', $config->get('int')); + $this->assertSame('99', $config->get('int')); // Test that re-saving without testing the data enforces the schema type. $config->save(); - $this->assertIdentical($data, $config->get()); + $this->assertSame($data, $config->get()); // Test that setting an unsupported type for a config object with a schema // fails. diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php index 79b01cb..7bc7fcc 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php @@ -328,7 +328,7 @@ public function testConfigEntityUninstallComplex(array $entity_id_suffixes) { $called = \Drupal::state()->get('config_test.on_dependency_removal_called', []); $this->assertFalse(in_array($entity_3->id(), $called), 'ConfigEntityInterface::onDependencyRemoval() is not called for entity 3.'); - $this->assertIdentical([$entity_1->id(), $entity_4->id(), $entity_2->id()], $called, 'The most dependent entites have ConfigEntityInterface::onDependencyRemoval() called first.'); + $this->assertSame([$entity_1->id(), $entity_4->id(), $entity_2->id()], $called, 'The most dependent entites have ConfigEntityInterface::onDependencyRemoval() called first.'); // Perform a module rebuild so we can know where the node module is located // and uninstall it. diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php index b69735e..cdd601f 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php @@ -166,11 +166,11 @@ protected function assertYamlEdit(array $edits, $field, $type, $orig = NULL, $cl $this->assertEqual($edit->type, $type, "The $field item in the diff is a $type"); // If an original value was given, assert that it matches. if (isset($orig)) { - $this->assertIdentical($edit->orig, $orig, "The original value for key '$field' is correct."); + $this->assertSame($edit->orig, $orig, "The original value for key '$field' is correct."); } // If a closing value was given, assert that it matches. if (isset($closing)) { - $this->assertIdentical($edit->closing, $closing, "The closing value for key '$field' is correct."); + $this->assertSame($edit->closing, $closing, "The closing value for key '$field' is correct."); } // Break out of the search entirely. break 2; diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php index 5a137b9..da680af 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php @@ -40,7 +40,7 @@ public function testNormalize() { $config_entity->save(); $config = $this->config('config_test.dynamic.system'); - $this->assertIdentical($config_entity->toArray(), $config->getRawData(), 'Stored config entity is equivalent to config schema.'); + $this->assertSame($config_entity->toArray(), $config->getRawData(), 'Stored config entity is equivalent to config schema.'); } } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php index 3c3f70b..b968b6b 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php @@ -57,7 +57,7 @@ public function testCacheHit() { // config_entity_static_cache_test_config_test_load() sets _loadStamp to a // random string. If they match, it means $entity_2 was retrieved from the // static cache rather than going through a separate load sequence. - $this->assertIdentical($entity_1->_loadStamp, $entity_2->_loadStamp); + $this->assertSame($entity_1->_loadStamp, $entity_2->_loadStamp); } /** @@ -73,7 +73,7 @@ public function testReset() { $entity->label = 'New label'; $entity->save(); $entity = $storage->load($this->entityId); - $this->assertIdentical($entity->label, 'New label'); + $this->assertSame($entity->label, 'New label'); // Ensure loading after a delete retrieves NULL rather than an obsolete // cached one. @@ -94,7 +94,7 @@ public function testConfigOverride() { // despite the prior cache priming. \Drupal::configFactory()->addOverride(new ConfigOverrider()); $entity_override = $storage->load($this->entityId); - $this->assertIdentical($entity_override->label, 'Overridden label'); + $this->assertSame($entity_override->label, 'Overridden label'); // Load override free to ensure that loading the config entity again does // not return the overridden value. @@ -103,10 +103,10 @@ public function testConfigOverride() { $this->assertNotIdentical($entity_override->_loadStamp, $entity_no_override->_loadStamp); // Reload the entity and ensure the cache is used. - $this->assertIdentical($storage->loadOverrideFree($this->entityId)->_loadStamp, $entity_no_override->_loadStamp); + $this->assertSame($storage->loadOverrideFree($this->entityId)->_loadStamp, $entity_no_override->_loadStamp); // Enable overrides and reload the entity and ensure the cache is used. - $this->assertIdentical($storage->load($this->entityId)->_loadStamp, $entity_override->_loadStamp); + $this->assertSame($storage->load($this->entityId)->_loadStamp, $entity_override->_loadStamp); } } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php index bf41e1d..4ead5b4 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php @@ -48,7 +48,7 @@ public function testUUIDConflict() { // Ensure that the config entity was not corrupted. $entity = entity_load('config_test', $entity->id(), TRUE); - $this->assertIdentical($entity->toArray(), $original_properties); + $this->assertSame($entity->toArray(), $original_properties); } } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php index 0010da7..83dab6a 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php @@ -52,7 +52,7 @@ public function testStorageMethods() { $expected_id = 'test_id'; $config_name = $entity_type->getConfigPrefix() . '.' . $expected_id; $storage = $this->storage; - $this->assertIdentical($storage::getIDFromConfigName($config_name, $entity_type->getConfigPrefix()), $expected_id); + $this->assertSame($storage::getIDFromConfigName($config_name, $entity_type->getConfigPrefix()), $expected_id); // Create three entities, two with the same style. $style = $this->randomMachineName(8); @@ -80,7 +80,7 @@ public function testStorageMethods() { // Compare UUIDs as the objects are not identical since // $entity->enforceIsNew is FALSE and $entity_loaded_by_uuid->enforceIsNew // is NULL. - $this->assertIdentical($entity->uuid(), $entity_loaded_by_uuid->uuid()); + $this->assertSame($entity->uuid(), $entity_loaded_by_uuid->uuid()); $entities = $this->storage->loadByProperties(); $this->assertEqual(count($entities), 3, 'Three entities are loaded when no properties are specified.'); @@ -90,7 +90,7 @@ public function testStorageMethods() { // Assert that both returned entities have a matching style property. foreach ($entities as $entity) { - $this->assertIdentical($entity->get('style'), $style, 'The loaded entity has the correct style value specified.'); + $this->assertSame($entity->get('style'), $style, 'The loaded entity has the correct style value specified.'); } // Test that schema type enforcement can be overridden by trusting the data. @@ -100,12 +100,12 @@ public function testStorageMethods() { 'style' => 999 ]); $entity->save(); - $this->assertIdentical('999', $entity->style); + $this->assertSame('999', $entity->style); $entity->style = 999; $entity->trustData()->save(); - $this->assertIdentical(999, $entity->style); + $this->assertSame(999, $entity->style); $entity->save(); - $this->assertIdentical('999', $entity->style); + $this->assertSame('999', $entity->style); } } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEventsTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEventsTest.php index 74bb798..9c66d5b 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEventsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEventsTest.php @@ -28,28 +28,28 @@ public function testConfigEvents() { $config = new Config($name, \Drupal::service('config.storage'), \Drupal::service('event_dispatcher'), \Drupal::service('config.typed')); $config->set('key', 'initial'); - $this->assertIdentical(\Drupal::state()->get('config_events_test.event', []), [], 'No events fired by creating a new configuration object'); + $this->assertSame(\Drupal::state()->get('config_events_test.event', []), [], 'No events fired by creating a new configuration object'); $config->save(); $event = \Drupal::state()->get('config_events_test.event', []); - $this->assertIdentical($event['event_name'], ConfigEvents::SAVE); - $this->assertIdentical($event['current_config_data'], ['key' => 'initial']); - $this->assertIdentical($event['raw_config_data'], ['key' => 'initial']); - $this->assertIdentical($event['original_config_data'], []); + $this->assertSame($event['event_name'], ConfigEvents::SAVE); + $this->assertSame($event['current_config_data'], ['key' => 'initial']); + $this->assertSame($event['raw_config_data'], ['key' => 'initial']); + $this->assertSame($event['original_config_data'], []); $config->set('key', 'updated')->save(); $event = \Drupal::state()->get('config_events_test.event', []); - $this->assertIdentical($event['event_name'], ConfigEvents::SAVE); - $this->assertIdentical($event['current_config_data'], ['key' => 'updated']); - $this->assertIdentical($event['raw_config_data'], ['key' => 'updated']); - $this->assertIdentical($event['original_config_data'], ['key' => 'initial']); + $this->assertSame($event['event_name'], ConfigEvents::SAVE); + $this->assertSame($event['current_config_data'], ['key' => 'updated']); + $this->assertSame($event['raw_config_data'], ['key' => 'updated']); + $this->assertSame($event['original_config_data'], ['key' => 'initial']); $config->delete(); $event = \Drupal::state()->get('config_events_test.event', []); - $this->assertIdentical($event['event_name'], ConfigEvents::DELETE); - $this->assertIdentical($event['current_config_data'], []); - $this->assertIdentical($event['raw_config_data'], []); - $this->assertIdentical($event['original_config_data'], ['key' => 'updated']); + $this->assertSame($event['event_name'], ConfigEvents::DELETE); + $this->assertSame($event['current_config_data'], []); + $this->assertSame($event['raw_config_data'], []); + $this->assertSame($event['original_config_data'], ['key' => 'updated']); } /** @@ -64,18 +64,18 @@ public function testConfigRenameEvent() { $config = $this->config($name); $config->set('key', 'initial')->save(); $event = \Drupal::state()->get('config_events_test.event', []); - $this->assertIdentical($event['event_name'], ConfigEvents::SAVE); - $this->assertIdentical($event['current_config_data'], ['key' => 'initial']); + $this->assertSame($event['event_name'], ConfigEvents::SAVE); + $this->assertSame($event['current_config_data'], ['key' => 'initial']); // Override applies when getting runtime config. $this->assertEqual($GLOBALS['config'][$name], \Drupal::config($name)->get()); \Drupal::configFactory()->rename($name, $new_name); $event = \Drupal::state()->get('config_events_test.event', []); - $this->assertIdentical($event['event_name'], ConfigEvents::RENAME); - $this->assertIdentical($event['current_config_data'], ['key' => 'new overridden']); - $this->assertIdentical($event['raw_config_data'], ['key' => 'initial']); - $this->assertIdentical($event['original_config_data'], ['key' => 'new overridden']); + $this->assertSame($event['event_name'], ConfigEvents::RENAME); + $this->assertSame($event['current_config_data'], ['key' => 'new overridden']); + $this->assertSame($event['raw_config_data'], ['key' => 'initial']); + $this->assertSame($event['original_config_data'], ['key' => 'new overridden']); } } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigFileContentTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigFileContentTest.php index 5366629..c73623f 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigFileContentTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigFileContentTest.php @@ -62,7 +62,7 @@ public function testReadWriteConfig() { // Verify nothing was saved. $data = $storage->read($name); - $this->assertIdentical($data, FALSE); + $this->assertSame($data, FALSE); // Add a top level value. $config = $this->config($name); @@ -122,7 +122,7 @@ public function testReadWriteConfig() { $this->assertTrue($config->get($true_key), "Boolean TRUE value returned the TRUE."); // Read null value. - $this->assertIdentical($config->get('null'), NULL); + $this->assertSame($config->get('null'), NULL); // Read false that had been nested in an array value. $this->assertSame($config->get($casting_array_false_value_key), FALSE, "Nested boolean FALSE value returned FALSE."); @@ -181,7 +181,7 @@ public function testReadWriteConfig() { // Verify the database entry no longer exists. $data = $storage->read($name); - $this->assertIdentical($data, FALSE); + $this->assertSame($data, FALSE); } /** @@ -210,22 +210,22 @@ public function testSerialization() { $config_parsed = $filestorage->read($name); $key = 'numeric keys'; - $this->assertIdentical($config_data[$key], $config_parsed[$key]); + $this->assertSame($config_data[$key], $config_parsed[$key]); $key = 'nested keys'; - $this->assertIdentical($config_data[$key], $config_parsed[$key]); + $this->assertSame($config_data[$key], $config_parsed[$key]); $key = 'HTML'; - $this->assertIdentical($config_data['nested keys'][$key], $config_parsed['nested keys'][$key]); + $this->assertSame($config_data['nested keys'][$key], $config_parsed['nested keys'][$key]); $key = 'UTF-8'; - $this->assertIdentical($config_data['nested keys'][$key], $config_parsed['nested keys'][$key]); + $this->assertSame($config_data['nested keys'][$key], $config_parsed['nested keys'][$key]); $key = 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΣὨ'; - $this->assertIdentical($config_data['nested keys'][$key], $config_parsed['nested keys'][$key]); + $this->assertSame($config_data['nested keys'][$key], $config_parsed['nested keys'][$key]); $key = 'invalid xml'; - $this->assertIdentical($config_data[$key], $config_parsed[$key]); + $this->assertSame($config_data[$key], $config_parsed[$key]); } } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRecreateTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRecreateTest.php index 0523ee8..c69f9fe 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRecreateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRecreateTest.php @@ -92,7 +92,7 @@ public function testRecreateEntity() { $this->assertEqual(5, count($creates), 'There are 5 configuration items to create.'); $this->assertEqual(5, count($deletes), 'There are 5 configuration items to delete.'); $this->assertEqual(0, count($this->configImporter->getUnprocessedConfiguration('update')), 'There are no configuration items to update.'); - $this->assertIdentical($creates, array_reverse($deletes), 'Deletes and creates contain the same configuration names in opposite orders due to dependencies.'); + $this->assertSame($creates, array_reverse($deletes), 'Deletes and creates contain the same configuration names in opposite orders due to dependencies.'); $this->configImporter->import(); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php index e755d5f..cbb2e95 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php @@ -95,7 +95,7 @@ public function testRenameValidation() { 'node.type.' . $content_type->id() . '::config_test.dynamic.' . $test_entity_id, ]; $renames = $this->configImporter->getUnprocessedConfiguration('rename'); - $this->assertIdentical($expected, $renames); + $this->assertSame($expected, $renames); // Try to import the configuration. We expect an exception to be thrown // because the staged entity is of a different type. @@ -138,7 +138,7 @@ public function testRenameSimpleConfigValidation() { 'config_test.old::config_test.new' ]; $renames = $this->configImporter->getUnprocessedConfiguration('rename'); - $this->assertIdentical($expected, $renames); + $this->assertSame($expected, $renames); // Try to import the configuration. We expect an exception to be thrown // because the rename is for simple configuration. diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php index 0ecc38c..5f87fb2 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php @@ -68,7 +68,7 @@ public function testNoImport() { // Verify the default configuration values exist. $config = $this->config($dynamic_name); - $this->assertIdentical($config->get('id'), 'dotted.default'); + $this->assertSame($config->get('id'), 'dotted.default'); // Verify that a bare $this->config() does not involve module APIs. $this->assertFalse(isset($GLOBALS['hook_config_test'])); @@ -121,7 +121,7 @@ public function testDeleted() { // Verify the default configuration values exist. $config = $this->config($dynamic_name); - $this->assertIdentical($config->get('id'), 'dotted.default'); + $this->assertSame($config->get('id'), 'dotted.default'); // Delete the file from the sync directory. $sync->delete($dynamic_name); @@ -130,10 +130,10 @@ public function testDeleted() { $this->configImporter->reset()->import(); // Verify the file has been removed. - $this->assertIdentical($storage->read($dynamic_name), FALSE); + $this->assertSame($storage->read($dynamic_name), FALSE); $config = $this->config($dynamic_name); - $this->assertIdentical($config->get('id'), NULL); + $this->assertSame($config->get('id'), NULL); // Verify that appropriate module API hooks have been invoked. $this->assertTrue(isset($GLOBALS['hook_config_test']['load'])); @@ -157,7 +157,7 @@ public function testNew() { $sync = $this->container->get('config.storage.sync'); // Verify the configuration to create does not exist yet. - $this->assertIdentical($storage->exists($dynamic_name), FALSE, $dynamic_name . ' not found.'); + $this->assertSame($storage->exists($dynamic_name), FALSE, $dynamic_name . ' not found.'); // Create new config entity. $original_dynamic_data = [ @@ -175,14 +175,14 @@ public function testNew() { ]; $sync->write($dynamic_name, $original_dynamic_data); - $this->assertIdentical($sync->exists($dynamic_name), TRUE, $dynamic_name . ' found.'); + $this->assertSame($sync->exists($dynamic_name), TRUE, $dynamic_name . ' found.'); // Import. $this->configImporter->reset()->import(); // Verify the values appeared. $config = $this->config($dynamic_name); - $this->assertIdentical($config->get('label'), $original_dynamic_data['label']); + $this->assertSame($config->get('label'), $original_dynamic_data['label']); // Verify that appropriate module API hooks have been invoked. $this->assertFalse(isset($GLOBALS['hook_config_test']['load'])); @@ -351,7 +351,7 @@ public function testSecondaryUpdateDeletedDeleterFirst() { $name_deletee, $name_other, ]; - $this->assertIdentical($expected, $updates); + $this->assertSame($expected, $updates); // Import. $this->configImporter->import(); @@ -478,8 +478,8 @@ public function testUpdated() { $sync = $this->container->get('config.storage.sync'); // Verify that the configuration objects to import exist. - $this->assertIdentical($storage->exists($name), TRUE, $name . ' found.'); - $this->assertIdentical($storage->exists($dynamic_name), TRUE, $dynamic_name . ' found.'); + $this->assertSame($storage->exists($name), TRUE, $name . ' found.'); + $this->assertSame($storage->exists($dynamic_name), TRUE, $dynamic_name . ' found.'); // Replace the file content of the existing configuration objects in the // sync directory. @@ -493,9 +493,9 @@ public function testUpdated() { // Verify the active configuration still returns the default values. $config = $this->config($name); - $this->assertIdentical($config->get('foo'), 'bar'); + $this->assertSame($config->get('foo'), 'bar'); $config = $this->config($dynamic_name); - $this->assertIdentical($config->get('label'), 'Default'); + $this->assertSame($config->get('label'), 'Default'); // Import. $this->configImporter->reset()->import(); @@ -503,13 +503,13 @@ public function testUpdated() { // Verify the values were updated. \Drupal::configFactory()->reset($name); $config = $this->config($name); - $this->assertIdentical($config->get('foo'), 'beer'); + $this->assertSame($config->get('foo'), 'beer'); $config = $this->config($dynamic_name); - $this->assertIdentical($config->get('label'), 'Updated'); + $this->assertSame($config->get('label'), 'Updated'); // Verify that the original file content is still the same. - $this->assertIdentical($sync->read($name), $original_name_data); - $this->assertIdentical($sync->read($dynamic_name), $original_dynamic_data); + $this->assertSame($sync->read($name), $original_name_data); + $this->assertSame($sync->read($dynamic_name), $original_dynamic_data); // Verify that appropriate module API hooks have been invoked. $this->assertTrue(isset($GLOBALS['hook_config_test']['load'])); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php index 8203b31..8c84b78 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php @@ -40,9 +40,9 @@ public function testModuleInstallation() { // Verify that default module config does not exist before installation yet. $config = $this->config($default_config); - $this->assertIdentical($config->isNew(), TRUE); + $this->assertSame($config->isNew(), TRUE); $config = $this->config($default_configuration_entity); - $this->assertIdentical($config->isNew(), TRUE); + $this->assertSame($config->isNew(), TRUE); // Ensure that schema provided by modules that are not installed is not // available. @@ -55,9 +55,9 @@ public function testModuleInstallation() { \Drupal::configFactory()->reset($default_config); \Drupal::configFactory()->reset($default_configuration_entity); $config = $this->config($default_config); - $this->assertIdentical($config->isNew(), FALSE); + $this->assertSame($config->isNew(), FALSE); $config = $this->config($default_configuration_entity); - $this->assertIdentical($config->isNew(), FALSE); + $this->assertSame($config->isNew(), FALSE); // Verify that config_test API hooks were invoked for the dynamic default // configuration entity. @@ -146,7 +146,7 @@ public function testCollectionInstallationCollections() { $this->assertEqual($collections, $active_storage->getAllCollectionNames()); $collection_storage = $active_storage->createCollection('entity'); $data = $collection_storage->read('config_test.dynamic.dotted.default'); - $this->assertIdentical(['label' => 'entity'], $data); + $this->assertSame(['label' => 'entity'], $data); // Test that the config manager uninstalls configuration from collections // as expected. @@ -185,7 +185,7 @@ public function testCollectionInstallationCollectionConfigEntity() { $data = $active_storage->read($name); $this->assertTrue(isset($data['uuid'])); $data = $collection_storage->read($name); - $this->assertIdentical(['label' => 'entity'], $data); + $this->assertSame(['label' => 'entity'], $data); } /** @@ -218,7 +218,7 @@ public function testDependencyChecking() { $this->assertTrue($entity, 'The config_test.dynamic.other_module_test_with_dependency configuration has been created during install.'); // Ensure that dependencies can be added during module installation by // hooks. - $this->assertIdentical('config_install_dependency_test', $entity->getDependencies()['module'][0]); + $this->assertSame('config_install_dependency_test', $entity->getDependencies()['module'][0]); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php index 5bf6f0e..bc1e6ca 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php @@ -36,22 +36,22 @@ public function testConfigLanguageOverride() { // English overrides work. \Drupal::languageManager()->setConfigOverrideLanguage(\Drupal::languageManager()->getLanguage('en')); $config = \Drupal::config('config_test.system'); - $this->assertIdentical($config->get('foo'), 'en bar'); + $this->assertSame($config->get('foo'), 'en bar'); // Ensure that the raw data is not translated. $raw = $config->getRawData(); - $this->assertIdentical($raw['foo'], 'bar'); + $this->assertSame($raw['foo'], 'bar'); ConfigurableLanguage::createFromLangcode('fr')->save(); ConfigurableLanguage::createFromLangcode('de')->save(); \Drupal::languageManager()->setConfigOverrideLanguage(\Drupal::languageManager()->getLanguage('fr')); $config = \Drupal::config('config_test.system'); - $this->assertIdentical($config->get('foo'), 'fr bar'); + $this->assertSame($config->get('foo'), 'fr bar'); \Drupal::languageManager()->setConfigOverrideLanguage(\Drupal::languageManager()->getLanguage('de')); $config = \Drupal::config('config_test.system'); - $this->assertIdentical($config->get('foo'), 'de bar'); + $this->assertSame($config->get('foo'), 'de bar'); // Test overrides of completely new configuration objects. In normal runtime // this should only happen for configuration entities as we should not be @@ -62,8 +62,8 @@ public function testConfigLanguageOverride() { ->save(); $config = \Drupal::config('config_test.new'); $this->assertTrue($config->isNew(), 'The configuration object config_test.new is new'); - $this->assertIdentical($config->get('language'), 'override'); - $this->assertIdentical($config->getOriginal('language', FALSE), NULL); + $this->assertSame($config->get('language'), 'override'); + $this->assertSame($config->getOriginal('language', FALSE), NULL); // Test how overrides react to base configuration changes. Set up some base // values. @@ -82,7 +82,7 @@ public function testConfigLanguageOverride() { ->save(); \Drupal::configFactory()->clearStaticCache(); $config = \Drupal::config('config_test.foo'); - $this->assertIdentical($config->get('value'), ['key' => 'override']); + $this->assertSame($config->get('value'), ['key' => 'override']); // Ensure renaming the config will rename the override. \Drupal::languageManager()->setConfigOverrideLanguage(\Drupal::languageManager()->getLanguage('en')); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigModuleOverridesTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigModuleOverridesTest.php index a94123d..dfe78fc 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigModuleOverridesTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigModuleOverridesTest.php @@ -42,8 +42,8 @@ public function testSimpleModuleOverrides() { // creating simple configuration objects on the fly. $config = $config_factory->get('config_override_test.new'); $this->assertTrue($config->isNew(), 'The configuration object config_override_test.new is new'); - $this->assertIdentical($config->get('module'), 'override'); - $this->assertIdentical($config->getOriginal('module', FALSE), NULL); + $this->assertSame($config->get('module'), 'override'); + $this->assertSame($config->getOriginal('module', FALSE), NULL); unset($GLOBALS['config_test_run_module_overrides']); } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigOverrideTest.php index b2ddaa3..9b2a961 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigOverrideTest.php @@ -46,25 +46,25 @@ public function testConfOverride() { // directly otherwise overrides will apply. $active = $this->container->get('config.storage'); $data = $active->read('config_test.system'); - $this->assertIdentical($data['foo'], $expected_original_data['foo']); + $this->assertSame($data['foo'], $expected_original_data['foo']); $this->assertFalse(isset($data['baz'])); - $this->assertIdentical($data['404'], $expected_original_data['404']); + $this->assertSame($data['404'], $expected_original_data['404']); // Get the configuration object with overrides. $config = \Drupal::configFactory()->get('config_test.system'); // Verify that it contains the overridden data from $config. - $this->assertIdentical($config->get('foo'), $overrides['config_test.system']['foo']); - $this->assertIdentical($config->get('baz'), $overrides['config_test.system']['baz']); - $this->assertIdentical($config->get('404'), $overrides['config_test.system']['404']); + $this->assertSame($config->get('foo'), $overrides['config_test.system']['foo']); + $this->assertSame($config->get('baz'), $overrides['config_test.system']['baz']); + $this->assertSame($config->get('404'), $overrides['config_test.system']['404']); // Get the configuration object which does not have overrides. $config = \Drupal::configFactory()->getEditable('config_test.system'); // Verify that it does not contains the overridden data from $config. - $this->assertIdentical($config->get('foo'), $expected_original_data['foo']); - $this->assertIdentical($config->get('baz'), NULL); - $this->assertIdentical($config->get('404'), $expected_original_data['404']); + $this->assertSame($config->get('foo'), $expected_original_data['foo']); + $this->assertSame($config->get('baz'), NULL); + $this->assertSame($config->get('404'), $expected_original_data['404']); // Set the value for 'baz' (on the original data). $expected_original_data['baz'] = 'original baz'; @@ -79,14 +79,14 @@ public function testConfOverride() { // Reload it and verify that it still contains overridden data from $config. $config = \Drupal::config('config_test.system'); - $this->assertIdentical($config->get('foo'), $overrides['config_test.system']['foo']); - $this->assertIdentical($config->get('baz'), $overrides['config_test.system']['baz']); - $this->assertIdentical($config->get('404'), $overrides['config_test.system']['404']); + $this->assertSame($config->get('foo'), $overrides['config_test.system']['foo']); + $this->assertSame($config->get('baz'), $overrides['config_test.system']['baz']); + $this->assertSame($config->get('404'), $overrides['config_test.system']['404']); // Verify that raw config data has changed. - $this->assertIdentical($config->getOriginal('foo', FALSE), $expected_original_data['foo']); - $this->assertIdentical($config->getOriginal('baz', FALSE), $expected_original_data['baz']); - $this->assertIdentical($config->getOriginal('404', FALSE), $expected_original_data['404']); + $this->assertSame($config->getOriginal('foo', FALSE), $expected_original_data['foo']); + $this->assertSame($config->getOriginal('baz', FALSE), $expected_original_data['baz']); + $this->assertSame($config->getOriginal('404', FALSE), $expected_original_data['404']); // Write file to sync. $sync = $this->container->get('config.storage.sync'); @@ -102,15 +102,15 @@ public function testConfOverride() { // Verify that the new configuration data exists. Have to read storage // directly otherwise overrides will apply. - $this->assertIdentical($data['foo'], $expected_new_data['foo']); + $this->assertSame($data['foo'], $expected_new_data['foo']); $this->assertFalse(isset($data['baz'])); - $this->assertIdentical($data['404'], $expected_new_data['404']); + $this->assertSame($data['404'], $expected_new_data['404']); // Verify that the overrides are still working. $config = \Drupal::config('config_test.system'); - $this->assertIdentical($config->get('foo'), $overrides['config_test.system']['foo']); - $this->assertIdentical($config->get('baz'), $overrides['config_test.system']['baz']); - $this->assertIdentical($config->get('404'), $overrides['config_test.system']['404']); + $this->assertSame($config->get('foo'), $overrides['config_test.system']['foo']); + $this->assertSame($config->get('baz'), $overrides['config_test.system']['baz']); + $this->assertSame($config->get('404'), $overrides['config_test.system']['404']); // Test overrides of completely new configuration objects. In normal runtime // this should only happen for configuration entities as we should not be @@ -118,9 +118,9 @@ public function testConfOverride() { $GLOBALS['config']['config_test.new']['key'] = 'override'; $config = \Drupal::config('config_test.new'); $this->assertTrue($config->isNew(), 'The configuration object config_test.new is new'); - $this->assertIdentical($config->get('key'), 'override'); + $this->assertSame($config->get('key'), 'override'); $config_raw = \Drupal::configFactory()->getEditable('config_test.new'); - $this->assertIdentical($config_raw->get('key'), NULL); + $this->assertSame($config_raw->get('key'), NULL); $config_raw ->set('key', 'raw') ->set('new_key', 'new_value') @@ -129,10 +129,10 @@ public function testConfOverride() { // accordingly. $config = \Drupal::config('config_test.new'); $this->assertFalse($config->isNew(), 'The configuration object config_test.new is not new'); - $this->assertIdentical($config->get('key'), 'override'); - $this->assertIdentical($config->get('new_key'), 'new_value'); + $this->assertSame($config->get('key'), 'override'); + $this->assertSame($config->get('new_key'), 'new_value'); $raw_data = $config->getRawData(); - $this->assertIdentical($raw_data['key'], 'raw'); + $this->assertSame($raw_data['key'], 'raw'); } } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php index 96bd18c..1588beb 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php @@ -40,7 +40,7 @@ protected function setUp() { */ public function testSchemaMapping() { // Nonexistent configuration key will have Undefined as metadata. - $this->assertIdentical(FALSE, \Drupal::service('config.typed')->hasConfigSchema('config_schema_test.no_such_key')); + $this->assertSame(FALSE, \Drupal::service('config.typed')->hasConfigSchema('config_schema_test.no_such_key')); $definition = \Drupal::service('config.typed')->getDefinition('config_schema_test.no_such_key'); $expected = []; $expected['label'] = 'Undefined'; @@ -50,12 +50,12 @@ public function testSchemaMapping() { $this->assertEqual($definition, $expected, 'Retrieved the right metadata for nonexistent configuration.'); // Configuration file without schema will return Undefined as well. - $this->assertIdentical(FALSE, \Drupal::service('config.typed')->hasConfigSchema('config_schema_test.noschema')); + $this->assertSame(FALSE, \Drupal::service('config.typed')->hasConfigSchema('config_schema_test.noschema')); $definition = \Drupal::service('config.typed')->getDefinition('config_schema_test.noschema'); $this->assertEqual($definition, $expected, 'Retrieved the right metadata for configuration with no schema.'); // Configuration file with only some schema. - $this->assertIdentical(TRUE, \Drupal::service('config.typed')->hasConfigSchema('config_schema_test.someschema')); + $this->assertSame(TRUE, \Drupal::service('config.typed')->hasConfigSchema('config_schema_test.someschema')); $definition = \Drupal::service('config.typed')->getDefinition('config_schema_test.someschema'); $expected = []; $expected['label'] = 'Schema test data'; @@ -376,13 +376,13 @@ public function testConfigSaveWithSchema() { $this->config('config_schema_test.schema_data_types') ->setData($untyped_to_typed) ->save(); - $this->assertIdentical($this->config('config_schema_test.schema_data_types')->get(), $typed_values); + $this->assertSame($this->config('config_schema_test.schema_data_types')->get(), $typed_values); // Save config which does not have a schema that enforces types. $this->config('config_schema_test.no_schema_data_types') ->setData($untyped_values) ->save(); - $this->assertIdentical($this->config('config_schema_test.no_schema_data_types')->get(), $untyped_values); + $this->assertSame($this->config('config_schema_test.no_schema_data_types')->get(), $untyped_values); // Ensure that configuration objects with keys marked as ignored are not // changed when saved. The 'config_schema_test.ignore' will have been saved @@ -392,7 +392,7 @@ public function testConfigSaveWithSchema() { $original_data = $install_storage->read('config_schema_test.ignore'); $installed_data = $this->config('config_schema_test.ignore')->get(); unset($installed_data['_core']); - $this->assertIdentical($installed_data, $original_data); + $this->assertSame($installed_data, $original_data); } /** @@ -489,7 +489,7 @@ public function testSchemaFallback() { $definition2 = \Drupal::service('config.typed')->getDefinition('config_schema_test.wildcard_fallback.something.something'); // This should be the schema of config_schema_test.wildcard_fallback.* as //well. - $this->assertIdentical($definition, $definition2); + $this->assertSame($definition, $definition2); } /** @@ -603,7 +603,7 @@ public function testConfigSaveWithWrappingSchema() { \Drupal::configFactory()->getEditable('wrapping.config_schema_test.plugin_types') ->setData($untyped_values) ->save(); - $this->assertIdentical(\Drupal::config('wrapping.config_schema_test.plugin_types') + $this->assertSame(\Drupal::config('wrapping.config_schema_test.plugin_types') ->get(), $typed_values); } @@ -639,7 +639,7 @@ public function testConfigSaveWithWrappingSchemaDoubleBrackets() { \Drupal::configFactory()->getEditable('wrapping.config_schema_test.double_brackets') ->setData($untyped_values) ->save(); - $this->assertIdentical(\Drupal::config('wrapping.config_schema_test.double_brackets') + $this->assertSame(\Drupal::config('wrapping.config_schema_test.double_brackets') ->get(), $typed_values); $tests = \Drupal::service('config.typed')->get('wrapping.config_schema_test.double_brackets')->get('tests')->getElements(); @@ -673,7 +673,7 @@ public function testConfigSaveWithWrappingSchemaDoubleBrackets() { \Drupal::configFactory()->getEditable('wrapping.config_schema_test.double_brackets') ->setData($untyped_values) ->save(); - $this->assertIdentical(\Drupal::config('wrapping.config_schema_test.double_brackets') + $this->assertSame(\Drupal::config('wrapping.config_schema_test.double_brackets') ->get(), $typed_values); $tests = \Drupal::service('config.typed')->get('wrapping.config_schema_test.double_brackets')->get('tests')->getElements(); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSnapshotTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSnapshotTest.php index 62eff04..b476d00 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSnapshotTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSnapshotTest.php @@ -76,7 +76,7 @@ public function testSnapshot() { // Verify changed config was properly imported. \Drupal::configFactory()->reset($config_name); - $this->assertIdentical($this->config($config_name)->get($config_key), $new_data); + $this->assertSame($this->config($config_name)->get($config_key), $new_data); // Verify that a new snapshot was created which and that it matches // the active config. diff --git a/core/tests/Drupal/KernelTests/Core/Config/SchemaCheckTraitTest.php b/core/tests/Drupal/KernelTests/Core/Config/SchemaCheckTraitTest.php index 68a8962..6badf22 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/SchemaCheckTraitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/SchemaCheckTraitTest.php @@ -44,12 +44,12 @@ protected function setUp() { public function testTrait() { // Test a non existing schema. $ret = $this->checkConfigSchema($this->typedConfig, 'config_schema_test.noschema', $this->config('config_schema_test.noschema')->get()); - $this->assertIdentical($ret, FALSE); + $this->assertSame($ret, FALSE); // Test an existing schema with valid data. $config_data = $this->config('config_test.types')->get(); $ret = $this->checkConfigSchema($this->typedConfig, 'config_test.types', $config_data); - $this->assertIdentical($ret, TRUE); + $this->assertSame($ret, TRUE); // Add a new key, a new array and overwrite boolean with array to test the // error messages. diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php index 54d0164..78e8b7a 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php @@ -37,26 +37,26 @@ public function testCRUD() { $name = 'config_test.storage'; // Checking whether a non-existing name exists returns FALSE. - $this->assertIdentical($this->storage->exists($name), FALSE); + $this->assertSame($this->storage->exists($name), FALSE); // Reading a non-existing name returns FALSE. $data = $this->storage->read($name); - $this->assertIdentical($data, FALSE); + $this->assertSame($data, FALSE); // Writing data returns TRUE and the data has been written. $data = ['foo' => 'bar']; $result = $this->storage->write($name, $data); - $this->assertIdentical($result, TRUE); + $this->assertSame($result, TRUE); $raw_data = $this->read($name); - $this->assertIdentical($raw_data, $data); + $this->assertSame($raw_data, $data); // Checking whether an existing name exists returns TRUE. - $this->assertIdentical($this->storage->exists($name), TRUE); + $this->assertSame($this->storage->exists($name), TRUE); // Writing the identical data again still returns TRUE. $result = $this->storage->write($name, $data); - $this->assertIdentical($result, TRUE); + $this->assertSame($result, TRUE); // Listing all names returns all. $names = $this->storage->listAll(); @@ -72,17 +72,17 @@ public function testCRUD() { $new_name = 'config_test.storage_rename'; $this->storage->rename($name, $new_name); $raw_data = $this->read($new_name); - $this->assertIdentical($raw_data, $data); + $this->assertSame($raw_data, $data); // Rename it back so further tests work. $this->storage->rename($new_name, $name); // Deleting an existing name returns TRUE. $result = $this->storage->delete($name); - $this->assertIdentical($result, TRUE); + $this->assertSame($result, TRUE); // Deleting a non-existing name returns FALSE. $result = $this->storage->delete($name); - $this->assertIdentical($result, FALSE); + $this->assertSame($result, FALSE); // Deleting all names with prefix deletes the appropriate data and returns // TRUE. @@ -97,8 +97,8 @@ public function testCRUD() { $result = $this->storage->deleteAll('config_test.'); $names = $this->storage->listAll('config_test.'); - $this->assertIdentical($result, TRUE); - $this->assertIdentical($names, []); + $this->assertSame($result, TRUE); + $this->assertSame($names, []); // Test renaming an object that does not exist throws an exception. try { @@ -129,14 +129,14 @@ public function testInvalidStorage() { // pollute one another. $data = ['foo' => 'bar']; $result = $this->storage->write($name, $data); - $this->assertIdentical($result, TRUE); + $this->assertSame($result, TRUE); $raw_data = $this->read($name); - $this->assertIdentical($raw_data, $data); + $this->assertSame($raw_data, $data); // Reading from a non-existing storage bin returns FALSE. $result = $this->invalidStorage->read($name); - $this->assertIdentical($result, FALSE); + $this->assertSame($result, FALSE); // Deleting from a non-existing storage bin throws an exception. try { @@ -150,11 +150,11 @@ public function testInvalidStorage() { // Listing on a non-existing storage bin returns an empty array. $result = $this->invalidStorage->listAll(); - $this->assertIdentical($result, []); + $this->assertSame($result, []); // Writing to a non-existing storage bin creates the bin. $this->invalidStorage->write($name, ['foo' => 'bar']); $result = $this->invalidStorage->read($name); - $this->assertIdentical($result, ['foo' => 'bar']); + $this->assertSame($result, ['foo' => 'bar']); } /** @@ -175,10 +175,10 @@ public function testDataTypes() { ]; $result = $this->storage->write($name, $data); - $this->assertIdentical($result, TRUE); + $this->assertSame($result, TRUE); $read_data = $this->storage->read($name); - $this->assertIdentical($read_data, $data); + $this->assertSame($read_data, $data); } /** @@ -188,49 +188,49 @@ public function testCollection() { $name = 'config_test.storage'; $data = ['foo' => 'bar']; $result = $this->storage->write($name, $data); - $this->assertIdentical($result, TRUE); - $this->assertIdentical($data, $this->storage->read($name)); + $this->assertSame($result, TRUE); + $this->assertSame($data, $this->storage->read($name)); // Create configuration in a new collection. $new_storage = $this->storage->createCollection('collection.sub.new'); $this->assertFalse($new_storage->exists($name)); $this->assertEqual([], $new_storage->listAll()); $new_storage->write($name, $data); - $this->assertIdentical($result, TRUE); - $this->assertIdentical($data, $new_storage->read($name)); + $this->assertSame($result, TRUE); + $this->assertSame($data, $new_storage->read($name)); $this->assertEqual([$name], $new_storage->listAll()); $this->assertTrue($new_storage->exists($name)); $new_data = ['foo' => 'baz']; $new_storage->write($name, $new_data); - $this->assertIdentical($result, TRUE); - $this->assertIdentical($new_data, $new_storage->read($name)); + $this->assertSame($result, TRUE); + $this->assertSame($new_data, $new_storage->read($name)); // Create configuration in another collection. $another_storage = $this->storage->createCollection('collection.sub.another'); $this->assertFalse($another_storage->exists($name)); $this->assertEqual([], $another_storage->listAll()); $another_storage->write($name, $new_data); - $this->assertIdentical($result, TRUE); - $this->assertIdentical($new_data, $another_storage->read($name)); + $this->assertSame($result, TRUE); + $this->assertSame($new_data, $another_storage->read($name)); $this->assertEqual([$name], $another_storage->listAll()); $this->assertTrue($another_storage->exists($name)); // Create configuration in yet another collection. $alt_storage = $this->storage->createCollection('alternate'); $alt_storage->write($name, $new_data); - $this->assertIdentical($result, TRUE); - $this->assertIdentical($new_data, $alt_storage->read($name)); + $this->assertSame($result, TRUE); + $this->assertSame($new_data, $alt_storage->read($name)); // Switch back to the collection-less mode and check the data still exists // add has not been touched. - $this->assertIdentical($data, $this->storage->read($name)); + $this->assertSame($data, $this->storage->read($name)); // Check that the getAllCollectionNames() method works. - $this->assertIdentical(['alternate', 'collection.sub.another', 'collection.sub.new'], $this->storage->getAllCollectionNames()); + $this->assertSame(['alternate', 'collection.sub.another', 'collection.sub.new'], $this->storage->getAllCollectionNames()); // Check that the collections are removed when they are empty. $alt_storage->delete($name); - $this->assertIdentical(['collection.sub.another', 'collection.sub.new'], $this->storage->getAllCollectionNames()); + $this->assertSame(['collection.sub.another', 'collection.sub.new'], $this->storage->getAllCollectionNames()); // Create configuration in collection called 'collection'. This ensures that // FileStorage's collection storage works regardless of its use of @@ -239,20 +239,20 @@ public function testCollection() { $this->assertFalse($parent_storage->exists($name)); $this->assertEqual([], $parent_storage->listAll()); $parent_storage->write($name, $new_data); - $this->assertIdentical($result, TRUE); - $this->assertIdentical($new_data, $parent_storage->read($name)); + $this->assertSame($result, TRUE); + $this->assertSame($new_data, $parent_storage->read($name)); $this->assertEqual([$name], $parent_storage->listAll()); $this->assertTrue($parent_storage->exists($name)); - $this->assertIdentical(['collection', 'collection.sub.another', 'collection.sub.new'], $this->storage->getAllCollectionNames()); + $this->assertSame(['collection', 'collection.sub.another', 'collection.sub.new'], $this->storage->getAllCollectionNames()); $parent_storage->deleteAll(); - $this->assertIdentical(['collection.sub.another', 'collection.sub.new'], $this->storage->getAllCollectionNames()); + $this->assertSame(['collection.sub.another', 'collection.sub.new'], $this->storage->getAllCollectionNames()); // Check that the having an empty collection-less storage does not break // anything. Before deleting check that the previous delete did not affect // data in another collection. - $this->assertIdentical($data, $this->storage->read($name)); + $this->assertSame($data, $this->storage->read($name)); $this->storage->delete($name); - $this->assertIdentical(['collection.sub.another', 'collection.sub.new'], $this->storage->getAllCollectionNames()); + $this->assertSame(['collection.sub.another', 'collection.sub.new'], $this->storage->getAllCollectionNames()); } abstract protected function read($name); diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php index 23bd5ea..9f5c861 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php @@ -63,13 +63,13 @@ public function testlistAll() { ]; $config_files = $this->storage->listAll(); - $this->assertIdentical($config_files, $expected_files, 'Relative path, two config files found.'); + $this->assertSame($config_files, $expected_files, 'Relative path, two config files found.'); // @todo https://www.drupal.org/node/2666954 FileStorage::listAll() is // case-sensitive. However, \Drupal\Core\Config\DatabaseStorage::listAll() // is case-insensitive. - $this->assertIdentical(['system.performance'], $this->storage->listAll('system'), 'The FileStorage::listAll() with prefix works.'); - $this->assertIdentical([], $this->storage->listAll('System'), 'The FileStorage::listAll() is case sensitive.'); + $this->assertSame(['system.performance'], $this->storage->listAll('system'), 'The FileStorage::listAll() with prefix works.'); + $this->assertSame([], $this->storage->listAll('System'), 'The FileStorage::listAll() is case sensitive.'); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php b/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php index 53a87b7..270e332 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php @@ -23,7 +23,7 @@ public function testConcatLiterals() { ':a4' => ' a ', ':a5' => 'test.', ]); - $this->assertIdentical($result->fetchField(), 'This is a test.', 'Basic CONCAT works.'); + $this->assertSame($result->fetchField(), 'This is a test.', 'Basic CONCAT works.'); } /** @@ -36,7 +36,7 @@ public function testConcatFields() { ':a3' => '.', ':age' => 25, ]); - $this->assertIdentical($result->fetchField(), 'The age of John is 25.', 'Field CONCAT works.'); + $this->assertSame($result->fetchField(), 'The age of John is 25.', 'Field CONCAT works.'); } /** @@ -49,7 +49,7 @@ public function testConcatWsLiterals() { ':a3' => '', ':a4' => 'world.', ]); - $this->assertIdentical($result->fetchField(), 'Hello, , world.'); + $this->assertSame($result->fetchField(), 'Hello, , world.'); } /** @@ -61,7 +61,7 @@ public function testConcatWsFields() { ':a2' => 'age', ':age' => 25, ]); - $this->assertIdentical($result->fetchField(), 'name-John-age-25'); + $this->assertSame($result->fetchField(), 'name-John-age-25'); } /** @@ -80,14 +80,14 @@ public function testLikeEscape() { ->countQuery() ->execute() ->fetchField(); - $this->assertIdentical($num_matches, '2', 'Found 2 records.'); + $this->assertSame($num_matches, '2', 'Found 2 records.'); // Match only "Ring_" using a LIKE expression with no wildcards. $num_matches = db_select('test', 't') ->condition('name', db_like('Ring_'), 'LIKE') ->countQuery() ->execute() ->fetchField(); - $this->assertIdentical($num_matches, '1', 'Found 1 record.'); + $this->assertSame($num_matches, '1', 'Found 1 record.'); } /** @@ -111,14 +111,14 @@ public function testLikeBackslash() { ->countQuery() ->execute() ->fetchField(); - $this->assertIdentical($num_matches, '2', 'Found 2 records.'); + $this->assertSame($num_matches, '2', 'Found 2 records.'); // Match only the former using a LIKE expression with no wildcards. $num_matches = db_select('test', 't') ->condition('name', db_like('abc%\_'), 'LIKE') ->countQuery() ->execute() ->fetchField(); - $this->assertIdentical($num_matches, '1', 'Found 1 record.'); + $this->assertSame($num_matches, '1', 'Found 1 record.'); } /** @@ -130,7 +130,7 @@ public function testGetFullQualifiedTableName() { ->countQuery() ->execute() ->fetchField(); - $this->assertIdentical($num_matches, '4', 'Found 4 records.'); + $this->assertSame($num_matches, '4', 'Found 4 records.'); } } diff --git a/core/tests/Drupal/KernelTests/Core/Database/CaseSensitivityTest.php b/core/tests/Drupal/KernelTests/Core/Database/CaseSensitivityTest.php index c3e766f..9d90126 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/CaseSensitivityTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/CaseSensitivityTest.php @@ -23,9 +23,9 @@ public function testCaseSensitiveInsert() { ->execute(); $num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField(); - $this->assertIdentical($num_records_before + 1, (int) $num_records_after, 'Record inserts correctly.'); + $this->assertSame($num_records_before + 1, (int) $num_records_after, 'Record inserts correctly.'); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'john'])->fetchField(); - $this->assertIdentical($saved_age, '2', 'Can retrieve after inserting.'); + $this->assertSame($saved_age, '2', 'Can retrieve after inserting.'); } } diff --git a/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php b/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php index e95afe0..103ff53 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php @@ -32,18 +32,18 @@ public function testConnectionRouting() { // Try to open those targets another time, that should return the same objects. $db1b = Database::getConnection('default', 'default'); $db2b = Database::getConnection('replica', 'default'); - $this->assertIdentical($db1, $db1b, 'A second call to getConnection() returns the same object.'); - $this->assertIdentical($db2, $db2b, 'A second call to getConnection() returns the same object.'); + $this->assertSame($db1, $db1b, 'A second call to getConnection() returns the same object.'); + $this->assertSame($db2, $db2b, 'A second call to getConnection() returns the same object.'); // Try to open an unknown target. $unknown_target = $this->randomMachineName(); $db3 = Database::getConnection($unknown_target, 'default'); $this->assertNotNull($db3, 'Opening an unknown target returns a real connection object.'); - $this->assertIdentical($db1, $db3, 'An unknown target opens the default connection.'); + $this->assertSame($db1, $db3, 'An unknown target opens the default connection.'); // Try to open that unknown target another time, that should return the same object. $db3b = Database::getConnection($unknown_target, 'default'); - $this->assertIdentical($db3, $db3b, 'A second call to getConnection() returns the same object.'); + $this->assertSame($db3, $db3b, 'A second call to getConnection() returns the same object.'); } /** @@ -61,7 +61,7 @@ public function testConnectionRoutingOverride() { $db1 = Database::getConnection('default', 'default'); $db2 = Database::getConnection('replica', 'default'); - $this->assertIdentical($db1, $db2, 'Both targets refer to the same connection.'); + $this->assertSame($db1, $db2, 'Both targets refer to the same connection.'); } /** @@ -103,7 +103,7 @@ public function testConnectionOptions() { // Get a fresh copy of the default connection options. $connectionOptions = $db->getConnectionOptions(); - $this->assertIdentical($connectionOptions, $connectionOptions2, 'The default and replica connection options are identical.'); + $this->assertSame($connectionOptions, $connectionOptions2, 'The default and replica connection options are identical.'); // Set up a new connection with different connection info. $test = $connection_info['default']; @@ -168,9 +168,9 @@ public function testPostgresqlReservedWords() { $stmt->execute(); foreach ($stmt->fetchAllAssoc('word') as $word => $row) { $expected = '"' . $word . '"'; - $this->assertIdentical($db->escapeTable($word), $expected, format_string('The reserved word %word was correctly escaped when used as a table name.', ['%word' => $word])); - $this->assertIdentical($db->escapeField($word), $expected, format_string('The reserved word %word was correctly escaped when used as a column name.', ['%word' => $word])); - $this->assertIdentical($db->escapeAlias($word), $expected, format_string('The reserved word %word was correctly escaped when used as an alias.', ['%word' => $word])); + $this->assertSame($db->escapeTable($word), $expected, format_string('The reserved word %word was correctly escaped when used as a table name.', ['%word' => $word])); + $this->assertSame($db->escapeField($word), $expected, format_string('The reserved word %word was correctly escaped when used as a column name.', ['%word' => $word])); + $this->assertSame($db->escapeAlias($word), $expected, format_string('The reserved word %word was correctly escaped when used as an alias.', ['%word' => $word])); } } diff --git a/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php b/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php index 6edcef8..f651a54 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php @@ -55,7 +55,7 @@ protected function addConnection() { // Verify that the new target exists. $info = Database::getConnectionInfo($this->key); // Note: Custom assertion message to not expose database credentials. - $this->assertIdentical($info[$this->target], $connection_info[$this->key], 'New connection info found.'); + $this->assertSame($info[$this->target], $connection_info[$this->key], 'New connection info found.'); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php b/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php index 8d73661..45fc18c 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php @@ -47,7 +47,7 @@ public function testSimpleDelete() { $num_deleted = db_delete('test') ->condition('id', 1) ->execute(); - $this->assertIdentical($num_deleted, 1, 'Deleted 1 record.'); + $this->assertSame($num_deleted, 1, 'Deleted 1 record.'); $num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField(); $this->assertEqual($num_records_before, $num_records_after + $num_deleted, 'Deletion adds up.'); @@ -75,7 +75,7 @@ public function testSpecialColumnDelete() { $num_deleted = db_delete('test_special_columns') ->condition('id', 1) ->execute(); - $this->assertIdentical($num_deleted, 1, 'Deleted 1 special column record.'); + $this->assertSame($num_deleted, 1, 'Deleted 1 special column record.'); $num_records_after = db_query('SELECT COUNT(*) FROM {test_special_columns}')->fetchField(); $this->assertEqual($num_records_before, $num_records_after + $num_deleted, 'Deletion adds up.'); diff --git a/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php b/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php index e55590e..881efc7 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php @@ -25,10 +25,10 @@ public function testQueryFetchDefault() { foreach ($result as $record) { $records[] = $record; $this->assertTrue(is_object($record), 'Record is an object.'); - $this->assertIdentical($record->name, 'John', '25 year old is John.'); + $this->assertSame($record->name, 'John', '25 year old is John.'); } - $this->assertIdentical(count($records), 1, 'There is only one record.'); + $this->assertSame(count($records), 1, 'There is only one record.'); } /** @@ -40,10 +40,10 @@ public function testQueryFetchObject() { foreach ($result as $record) { $records[] = $record; $this->assertTrue(is_object($record), 'Record is an object.'); - $this->assertIdentical($record->name, 'John', '25 year old is John.'); + $this->assertSame($record->name, 'John', '25 year old is John.'); } - $this->assertIdentical(count($records), 1, 'There is only one record.'); + $this->assertSame(count($records), 1, 'There is only one record.'); } /** @@ -55,11 +55,11 @@ public function testQueryFetchArray() { foreach ($result as $record) { $records[] = $record; if ($this->assertTrue(is_array($record), 'Record is an array.')) { - $this->assertIdentical($record['name'], 'John', 'Record can be accessed associatively.'); + $this->assertSame($record['name'], 'John', 'Record can be accessed associatively.'); } } - $this->assertIdentical(count($records), 1, 'There is only one record.'); + $this->assertSame(count($records), 1, 'There is only one record.'); } /** @@ -73,11 +73,11 @@ public function testQueryFetchClass() { foreach ($result as $record) { $records[] = $record; if ($this->assertTrue($record instanceof FakeRecord, 'Record is an object of class FakeRecord.')) { - $this->assertIdentical($record->name, 'John', '25 year old is John.'); + $this->assertSame($record->name, 'John', '25 year old is John.'); } } - $this->assertIdentical(count($records), 1, 'There is only one record.'); + $this->assertSame(count($records), 1, 'There is only one record.'); } /** @@ -89,11 +89,11 @@ public function testQueryFetchNum() { foreach ($result as $record) { $records[] = $record; if ($this->assertTrue(is_array($record), 'Record is an array.')) { - $this->assertIdentical($record[0], 'John', 'Record can be accessed numerically.'); + $this->assertSame($record[0], 'John', 'Record can be accessed numerically.'); } } - $this->assertIdentical(count($records), 1, 'There is only one record'); + $this->assertSame(count($records), 1, 'There is only one record'); } /** @@ -105,12 +105,12 @@ public function testQueryFetchBoth() { foreach ($result as $record) { $records[] = $record; if ($this->assertTrue(is_array($record), 'Record is an array.')) { - $this->assertIdentical($record[0], 'John', 'Record can be accessed numerically.'); - $this->assertIdentical($record['name'], 'John', 'Record can be accessed associatively.'); + $this->assertSame($record[0], 'John', 'Record can be accessed numerically.'); + $this->assertSame($record['name'], 'John', 'Record can be accessed associatively.'); } } - $this->assertIdentical(count($records), 1, 'There is only one record.'); + $this->assertSame(count($records), 1, 'There is only one record.'); } /** @@ -132,12 +132,12 @@ public function testQueryFetchAllColumn() { public function testQueryFetchCol() { $result = db_query('SELECT name FROM {test} WHERE age > :age', [':age' => 25]); $column = $result->fetchCol(); - $this->assertIdentical(count($column), 3, 'fetchCol() returns the right number of records.'); + $this->assertSame(count($column), 3, 'fetchCol() returns the right number of records.'); $result = db_query('SELECT name FROM {test} WHERE age > :age', [':age' => 25]); $i = 0; foreach ($result as $record) { - $this->assertIdentical($record->name, $column[$i++], 'Column matches direct access.'); + $this->assertSame($record->name, $column[$i++], 'Column matches direct access.'); } } diff --git a/core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php b/core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php index 5b6c03e..b5963cf 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php @@ -40,7 +40,7 @@ public function testDefaultEmptyInsert() { } $num_records_after = (int) db_query('SELECT COUNT(*) FROM {test}')->fetchField(); - $this->assertIdentical($num_records_before, $num_records_after, 'Do nothing as no fields are specified.'); + $this->assertSame($num_records_before, $num_records_after, 'Do nothing as no fields are specified.'); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php b/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php index 1c2c21d..5067200 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php @@ -22,13 +22,13 @@ public function testSimpleInsert() { ]); // Check how many records are queued for insertion. - $this->assertIdentical($query->count(), 1, 'One record is queued for insertion.'); + $this->assertSame($query->count(), 1, 'One record is queued for insertion.'); $query->execute(); $num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField(); - $this->assertIdentical($num_records_before + 1, (int) $num_records_after, 'Record inserts correctly.'); + $this->assertSame($num_records_before + 1, (int) $num_records_after, 'Record inserts correctly.'); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'Yoko'])->fetchField(); - $this->assertIdentical($saved_age, '29', 'Can retrieve after inserting.'); + $this->assertSame($saved_age, '29', 'Can retrieve after inserting.'); } /** @@ -50,24 +50,24 @@ public function testMultiInsert() { ]); // Check how many records are queued for insertion. - $this->assertIdentical($query->count(), 2, 'Two records are queued for insertion.'); + $this->assertSame($query->count(), 2, 'Two records are queued for insertion.'); // We should be able to say "use the field order". // This is not the recommended mechanism for most cases, but it should work. $query->values(['Moe', '32']); // Check how many records are queued for insertion. - $this->assertIdentical($query->count(), 3, 'Three records are queued for insertion.'); + $this->assertSame($query->count(), 3, 'Three records are queued for insertion.'); $query->execute(); $num_records_after = (int) db_query('SELECT COUNT(*) FROM {test}')->fetchField(); - $this->assertIdentical($num_records_before + 3, $num_records_after, 'Record inserts correctly.'); + $this->assertSame($num_records_before + 3, $num_records_after, 'Record inserts correctly.'); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'Larry'])->fetchField(); - $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.'); + $this->assertSame($saved_age, '30', 'Can retrieve after inserting.'); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'Curly'])->fetchField(); - $this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.'); + $this->assertSame($saved_age, '31', 'Can retrieve after inserting.'); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'Moe'])->fetchField(); - $this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.'); + $this->assertSame($saved_age, '32', 'Can retrieve after inserting.'); } /** @@ -83,7 +83,7 @@ public function testRepeatedInsert() { 'age' => '30', ]); // Check how many records are queued for insertion. - $this->assertIdentical($query->count(), 1, 'One record is queued for insertion.'); + $this->assertSame($query->count(), 1, 'One record is queued for insertion.'); $query->execute(); // This should run the insert, but leave the fields intact. // We should be able to specify values in any order if named. @@ -92,24 +92,24 @@ public function testRepeatedInsert() { 'name' => 'Curly', ]); // Check how many records are queued for insertion. - $this->assertIdentical($query->count(), 1, 'One record is queued for insertion.'); + $this->assertSame($query->count(), 1, 'One record is queued for insertion.'); $query->execute(); // We should be able to say "use the field order". $query->values(['Moe', '32']); // Check how many records are queued for insertion. - $this->assertIdentical($query->count(), 1, 'One record is queued for insertion.'); + $this->assertSame($query->count(), 1, 'One record is queued for insertion.'); $query->execute(); $num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField(); - $this->assertIdentical((int) $num_records_before + 3, (int) $num_records_after, 'Record inserts correctly.'); + $this->assertSame((int) $num_records_before + 3, (int) $num_records_after, 'Record inserts correctly.'); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'Larry'])->fetchField(); - $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.'); + $this->assertSame($saved_age, '30', 'Can retrieve after inserting.'); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'Curly'])->fetchField(); - $this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.'); + $this->assertSame($saved_age, '31', 'Can retrieve after inserting.'); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'Moe'])->fetchField(); - $this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.'); + $this->assertSame($saved_age, '32', 'Can retrieve after inserting.'); } /** @@ -125,11 +125,11 @@ public function testInsertFieldOnlyDefinition() { ->values(['Moe', '32']) ->execute(); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'Larry'])->fetchField(); - $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.'); + $this->assertSame($saved_age, '30', 'Can retrieve after inserting.'); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'Curly'])->fetchField(); - $this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.'); + $this->assertSame($saved_age, '31', 'Can retrieve after inserting.'); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'Moe'])->fetchField(); - $this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.'); + $this->assertSame($saved_age, '32', 'Can retrieve after inserting.'); } /** @@ -143,7 +143,7 @@ public function testInsertLastInsertID() { ]) ->execute(); - $this->assertIdentical($id, '5', 'Auto-increment ID returned successfully.'); + $this->assertSame($id, '5', 'Auto-increment ID returned successfully.'); } /** @@ -169,7 +169,7 @@ public function testInsertSelectFields() { ->execute(); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'Meredith'])->fetchField(); - $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.'); + $this->assertSame($saved_age, '30', 'Can retrieve after inserting.'); } /** @@ -190,7 +190,7 @@ public function testInsertSelectAll() { ->execute(); $saved_age = db_query('SELECT age FROM {test_people_copy} WHERE name = :name', [':name' => 'Meredith'])->fetchField(); - $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.'); + $this->assertSame($saved_age, '30', 'Can retrieve after inserting.'); } /** @@ -204,7 +204,7 @@ public function testSpecialColumnInsert() { ]) ->execute(); $saved_value = db_query('SELECT "offset" FROM {test_special_columns} WHERE id = :id', [':id' => 2])->fetchField(); - $this->assertIdentical($saved_value, 'Offset value 2', 'Can retrieve special column name value after inserting.'); + $this->assertSame($saved_value, 'Offset value 2', 'Can retrieve special column name value after inserting.'); } } diff --git a/core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php b/core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php index db4c7de..66eed0a 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/RegressionTest.php @@ -30,31 +30,31 @@ public function testRegression_310447() { ])->execute(); $from_database = db_query('SELECT job FROM {test} WHERE job = :job', [':job' => $job])->fetchField(); - $this->assertIdentical($job, $from_database, 'The database handles UTF-8 characters cleanly.'); + $this->assertSame($job, $from_database, 'The database handles UTF-8 characters cleanly.'); } /** * Tests the db_table_exists() function. */ public function testDBTableExists() { - $this->assertIdentical(TRUE, db_table_exists('test'), 'Returns true for existent table.'); - $this->assertIdentical(FALSE, db_table_exists('nosuchtable'), 'Returns false for nonexistent table.'); + $this->assertSame(TRUE, db_table_exists('test'), 'Returns true for existent table.'); + $this->assertSame(FALSE, db_table_exists('nosuchtable'), 'Returns false for nonexistent table.'); } /** * Tests the db_field_exists() function. */ public function testDBFieldExists() { - $this->assertIdentical(TRUE, db_field_exists('test', 'name'), 'Returns true for existent column.'); - $this->assertIdentical(FALSE, db_field_exists('test', 'nosuchcolumn'), 'Returns false for nonexistent column.'); + $this->assertSame(TRUE, db_field_exists('test', 'name'), 'Returns true for existent column.'); + $this->assertSame(FALSE, db_field_exists('test', 'nosuchcolumn'), 'Returns false for nonexistent column.'); } /** * Tests the db_index_exists() function. */ public function testDBIndexExists() { - $this->assertIdentical(TRUE, db_index_exists('test', 'ages'), 'Returns true for existent index.'); - $this->assertIdentical(FALSE, db_index_exists('test', 'nosuchindex'), 'Returns false for nonexistent index.'); + $this->assertSame(TRUE, db_index_exists('test', 'ages'), 'Returns true for existent index.'); + $this->assertSame(FALSE, db_index_exists('test', 'nosuchindex'), 'Returns false for nonexistent index.'); } } diff --git a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php index e239098..fcad1ec 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php @@ -93,12 +93,12 @@ public function testSchema() { // Test for fake index and test for the boolean result of indexExists(). $index_exists = Database::getConnection()->schema()->indexExists('test_table', 'test_field'); - $this->assertIdentical($index_exists, FALSE, 'Fake index does not exists'); + $this->assertSame($index_exists, FALSE, 'Fake index does not exists'); // Add index. db_add_index('test_table', 'test_field', ['test_field'], $table_specification); // Test for created index and test for the boolean result of indexExists(). $index_exists = Database::getConnection()->schema()->indexExists('test_table', 'test_field'); - $this->assertIdentical($index_exists, TRUE, 'Index created.'); + $this->assertSame($index_exists, TRUE, 'Index created.'); // Rename the table. db_rename_table('test_table', 'test_table2'); @@ -204,8 +204,8 @@ public function testSchema() { $unique_key_exists = Database::getConnection()->schema()->indexExists('test_table', 'test_field'); break; } - $this->assertIdentical($primary_key_exists, TRUE, 'Primary key created.'); - $this->assertIdentical($unique_key_exists, TRUE, 'Unique key created.'); + $this->assertSame($primary_key_exists, TRUE, 'Primary key created.'); + $this->assertSame($unique_key_exists, TRUE, 'Unique key created.'); db_rename_table('test_table', 'test_table2'); @@ -225,8 +225,8 @@ public function testSchema() { $renamed_unique_key_exists = Database::getConnection()->schema()->indexExists('test_table2', 'test_field'); break; } - $this->assertIdentical($renamed_primary_key_exists, TRUE, 'Primary key was renamed.'); - $this->assertIdentical($renamed_unique_key_exists, TRUE, 'Unique key was renamed.'); + $this->assertSame($renamed_primary_key_exists, TRUE, 'Primary key was renamed.'); + $this->assertSame($renamed_unique_key_exists, TRUE, 'Unique key was renamed.'); // For PostgreSQL check in addition that sequence was renamed. if ($db_type == 'pgsql') { @@ -758,7 +758,7 @@ protected function assertFieldChange($old_spec, $new_spec, $test_data = NULL) { ->condition('serial_column', $id) ->execute() ->fetchField(); - $this->assertIdentical($field_value, $test_data); + $this->assertSame($field_value, $test_data); } // Check the field was changed. diff --git a/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php b/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php index a07045d..40f0b7a 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php @@ -184,9 +184,9 @@ public function testTransactionRollBackNotSupported() { // Because our current database claims to not support transactions, // the inserted rows should be present despite the attempt to roll back. $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'DavidB'])->fetchField(); - $this->assertIdentical($saved_age, '24', 'DavidB not rolled back, since transactions are not supported.'); + $this->assertSame($saved_age, '24', 'DavidB not rolled back, since transactions are not supported.'); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'DanielB'])->fetchField(); - $this->assertIdentical($saved_age, '19', 'DanielB not rolled back, since transactions are not supported.'); + $this->assertSame($saved_age, '19', 'DanielB not rolled back, since transactions are not supported.'); } catch (\Exception $e) { $this->fail($e->getMessage()); @@ -206,9 +206,9 @@ public function testCommittedTransaction() { // Because we committed, both of the inserted rows should be present. $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'DavidA'])->fetchField(); - $this->assertIdentical($saved_age, '24', 'Can retrieve DavidA row after commit.'); + $this->assertSame($saved_age, '24', 'Can retrieve DavidA row after commit.'); $saved_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'DanielA'])->fetchField(); - $this->assertIdentical($saved_age, '19', 'Can retrieve DanielA row after commit.'); + $this->assertSame($saved_age, '19', 'Can retrieve DanielA row after commit.'); } catch (\Exception $e) { $this->fail($e->getMessage()); diff --git a/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php b/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php index 69d5d5d..6dc7b82 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php @@ -22,10 +22,10 @@ public function testOrConditionUpdate() { ->condition('name', 'Paul') ); $num_updated = $update->execute(); - $this->assertIdentical($num_updated, 2, 'Updated 2 records.'); + $this->assertSame($num_updated, 2, 'Updated 2 records.'); $num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '2', 'Updated fields successfully.'); + $this->assertSame($num_matches, '2', 'Updated fields successfully.'); } /** @@ -36,10 +36,10 @@ public function testInConditionUpdate() { ->fields(['job' => 'Musician']) ->condition('name', ['John', 'Paul'], 'IN') ->execute(); - $this->assertIdentical($num_updated, 2, 'Updated 2 records.'); + $this->assertSame($num_updated, 2, 'Updated 2 records.'); $num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '2', 'Updated fields successfully.'); + $this->assertSame($num_matches, '2', 'Updated fields successfully.'); } /** @@ -52,10 +52,10 @@ public function testNotInConditionUpdate() { ->fields(['job' => 'Musician']) ->condition('name', ['John', 'Paul', 'George'], 'NoT IN') ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertSame($num_updated, 1, 'Updated 1 record.'); $num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '1', 'Updated fields successfully.'); + $this->assertSame($num_matches, '1', 'Updated fields successfully.'); } /** @@ -66,10 +66,10 @@ public function testBetweenConditionUpdate() { ->fields(['job' => 'Musician']) ->condition('age', [25, 26], 'BETWEEN') ->execute(); - $this->assertIdentical($num_updated, 2, 'Updated 2 records.'); + $this->assertSame($num_updated, 2, 'Updated 2 records.'); $num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '2', 'Updated fields successfully.'); + $this->assertSame($num_matches, '2', 'Updated fields successfully.'); } /** @@ -80,10 +80,10 @@ public function testLikeConditionUpdate() { ->fields(['job' => 'Musician']) ->condition('name', '%ge%', 'LIKE') ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertSame($num_updated, 1, 'Updated 1 record.'); $num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '1', 'Updated fields successfully.'); + $this->assertSame($num_matches, '1', 'Updated fields successfully.'); } /** @@ -96,10 +96,10 @@ public function testUpdateExpression() { ->fields(['job' => 'Musician']) ->expression('age', 'age + :age', [':age' => 4]) ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertSame($num_updated, 1, 'Updated 1 record.'); $num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '1', 'Updated fields successfully.'); + $this->assertSame($num_matches, '1', 'Updated fields successfully.'); $person = db_query('SELECT * FROM {test} WHERE name = :name', [':name' => 'Ringo'])->fetch(); $this->assertEqual($person->name, 'Ringo', 'Name set correctly.'); @@ -116,7 +116,7 @@ public function testUpdateOnlyExpression() { ->condition('name', 'Ringo') ->expression('age', 'age + :age', [':age' => 4]) ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertSame($num_updated, 1, 'Updated 1 record.'); $after_age = db_query('SELECT age FROM {test} WHERE name = :name', [':name' => 'Ringo'])->fetchField(); $this->assertEqual($before_age + 4, $after_age, 'Age updated correctly'); diff --git a/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php b/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php index 6bc9131..08ab93a 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php @@ -17,10 +17,10 @@ public function testSimpleUpdate() { ->fields(['name' => 'Tiffany']) ->condition('id', 1) ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertSame($num_updated, 1, 'Updated 1 record.'); $saved_name = db_query('SELECT name FROM {test} WHERE id = :id', [':id' => 1])->fetchField(); - $this->assertIdentical($saved_name, 'Tiffany', 'Updated name successfully.'); + $this->assertSame($saved_name, 'Tiffany', 'Updated name successfully.'); } /** @@ -32,7 +32,7 @@ public function testSimpleNullUpdate() { ->fields(['age' => NULL]) ->condition('name', 'Kermit') ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertSame($num_updated, 1, 'Updated 1 record.'); $saved_age = db_query('SELECT age FROM {test_null} WHERE name = :name', [':name' => 'Kermit'])->fetchField(); $this->assertNull($saved_age, 'Updated name successfully.'); @@ -46,10 +46,10 @@ public function testMultiUpdate() { ->fields(['job' => 'Musician']) ->condition('job', 'Singer') ->execute(); - $this->assertIdentical($num_updated, 2, 'Updated 2 records.'); + $this->assertSame($num_updated, 2, 'Updated 2 records.'); $num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '2', 'Updated fields successfully.'); + $this->assertSame($num_matches, '2', 'Updated fields successfully.'); } /** @@ -60,10 +60,10 @@ public function testMultiGTUpdate() { ->fields(['job' => 'Musician']) ->condition('age', 26, '>') ->execute(); - $this->assertIdentical($num_updated, 2, 'Updated 2 records.'); + $this->assertSame($num_updated, 2, 'Updated 2 records.'); $num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '2', 'Updated fields successfully.'); + $this->assertSame($num_matches, '2', 'Updated fields successfully.'); } /** @@ -74,10 +74,10 @@ public function testWhereUpdate() { ->fields(['job' => 'Musician']) ->where('age > :age', [':age' => 26]) ->execute(); - $this->assertIdentical($num_updated, 2, 'Updated 2 records.'); + $this->assertSame($num_updated, 2, 'Updated 2 records.'); $num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '2', 'Updated fields successfully.'); + $this->assertSame($num_matches, '2', 'Updated fields successfully.'); } /** @@ -89,10 +89,10 @@ public function testWhereAndConditionUpdate() { ->where('age > :age', [':age' => 26]) ->condition('name', 'Ringo'); $num_updated = $update->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertSame($num_updated, 1, 'Updated 1 record.'); $num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '1', 'Updated fields successfully.'); + $this->assertSame($num_matches, '1', 'Updated fields successfully.'); } /** @@ -104,10 +104,10 @@ public function testExpressionUpdate() { $num_rows = db_update('test') ->expression('age', 'age * age') ->execute(); - $this->assertIdentical($num_rows, 4, 'Updated 4 records.'); + $this->assertSame($num_rows, 4, 'Updated 4 records.'); $saved_name = db_query('SELECT name FROM {test} WHERE age = :age', [':age' => pow(26, 2)])->fetchField(); - $this->assertIdentical($saved_name, 'Paul', 'Successfully updated values using an algebraic expression.'); + $this->assertSame($saved_name, 'Paul', 'Successfully updated values using an algebraic expression.'); } /** @@ -124,7 +124,7 @@ public function testUpdateAffectedRows() { ->condition('priority', 1, '<>') ->fields(['task' => 'sleep']) ->execute(); - $this->assertIdentical($num_rows, 5, 'Correctly returned 5 affected rows.'); + $this->assertSame($num_rows, 5, 'Correctly returned 5 affected rows.'); } /** @@ -135,10 +135,10 @@ public function testPrimaryKeyUpdate() { ->fields(['id' => 42, 'name' => 'John']) ->condition('id', 1) ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertSame($num_updated, 1, 'Updated 1 record.'); $saved_name = db_query('SELECT name FROM {test} WHERE id = :id', [':id' => 42])->fetchField(); - $this->assertIdentical($saved_name, 'John', 'Updated primary key successfully.'); + $this->assertSame($saved_name, 'John', 'Updated primary key successfully.'); } /** @@ -149,10 +149,10 @@ public function testSpecialColumnUpdate() { ->fields(['offset' => 'New offset value']) ->condition('id', 1) ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 special column record.'); + $this->assertSame($num_updated, 1, 'Updated 1 special column record.'); $saved_value = db_query('SELECT "offset" FROM {test_special_columns} WHERE id = :id', [':id' => 1])->fetchField(); - $this->assertIdentical($saved_value, 'New offset value', 'Updated special column name value successfully.'); + $this->assertSame($saved_value, 'New offset value', 'Updated special column name value successfully.'); } } diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php index deea2a9..9422d36 100644 --- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php +++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php @@ -23,7 +23,7 @@ public function testServicesYml() { // A service provider class always has precedence over services.yml files. // KernelTestBase::buildContainer() swaps out many services with in-memory // implementations already, so those cannot be tested. - $this->assertIdentical(get_class($this->container->get('cache.backend.database')), 'Drupal\Core\Cache\DatabaseBackendFactory'); + $this->assertSame(get_class($this->container->get('cache.backend.database')), 'Drupal\Core\Cache\DatabaseBackendFactory'); $class = __CLASS__; $doc = <<container->get('kernel')->rebuildContainer(); $this->assertTrue($this->container->has('site.service.yml')); - $this->assertIdentical(get_class($this->container->get('cache.backend.database')), 'Drupal\Core\Cache\MemoryBackendFactory'); + $this->assertSame(get_class($this->container->get('cache.backend.database')), 'Drupal\Core\Cache\MemoryBackendFactory'); } } diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php index 722bdd2..b5cb96b 100644 --- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php +++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php @@ -137,7 +137,7 @@ public function testCompileDIC() { // Check that the container itself is not among the persist IDs because it // does not make sense to persist the container itself. $persist_ids = $container->getParameter('persist_ids'); - $this->assertIdentical(FALSE, array_search('service_container', $persist_ids)); + $this->assertSame(FALSE, array_search('service_container', $persist_ids)); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php index 87ba104..729a32f 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php @@ -403,7 +403,7 @@ public function testCount() { $count = $this->factory->get('config_query_test') ->count() ->execute(); - $this->assertIdentical($count, count($this->entities)); + $this->assertSame($count, count($this->entities)); // Test count on a complex query. $query = $this->factory->get('config_query_test', 'OR'); @@ -418,7 +418,7 @@ public function testCount() { ->condition($and_condition_2) ->count() ->execute(); - $this->assertIdentical($count, 2); + $this->assertSame($count, 2); } /** @@ -429,52 +429,52 @@ public function testSortRange() { $this->queryResults = $this->factory->get('config_query_test') ->sort('number', 'DESC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['3', '5', '2', '1', '4']); + $this->assertSame(array_values($this->queryResults), ['3', '5', '2', '1', '4']); $this->queryResults = $this->factory->get('config_query_test') ->sort('number', 'ASC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['4', '1', '2', '5', '3']); + $this->assertSame(array_values($this->queryResults), ['4', '1', '2', '5', '3']); // Apply some filters and sort. $this->queryResults = $this->factory->get('config_query_test') ->condition('id', '3', '>') ->sort('number', 'DESC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['5', '4']); + $this->assertSame(array_values($this->queryResults), ['5', '4']); $this->queryResults = $this->factory->get('config_query_test') ->condition('id', '3', '>') ->sort('number', 'ASC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['4', '5']); + $this->assertSame(array_values($this->queryResults), ['4', '5']); // Apply a pager and sort. $this->queryResults = $this->factory->get('config_query_test') ->sort('number', 'DESC') ->range('2', '2') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['2', '1']); + $this->assertSame(array_values($this->queryResults), ['2', '1']); $this->queryResults = $this->factory->get('config_query_test') ->sort('number', 'ASC') ->range('2', '2') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['2', '5']); + $this->assertSame(array_values($this->queryResults), ['2', '5']); // Add a range to a query without a start parameter. $this->queryResults = $this->factory->get('config_query_test') ->range(0, '3') ->sort('id', 'ASC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['1', '2', '3']); + $this->assertSame(array_values($this->queryResults), ['1', '2', '3']); // Apply a pager with limit 4. $this->queryResults = $this->factory->get('config_query_test') ->pager('4', 0) ->sort('id', 'ASC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['1', '2', '3', '4']); + $this->assertSame(array_values($this->queryResults), ['1', '2', '3', '4']); } /** @@ -492,28 +492,28 @@ public function testTableSort() { ->tableSort($header) ->sort('id', 'DESC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['5', '4', '3', '2', '1']); + $this->assertSame(array_values($this->queryResults), ['5', '4', '3', '2', '1']); // Sorting with 'ASC' upper case $this->queryResults = $this->factory->get('config_query_test') ->tableSort($header) ->sort('id', 'ASC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['1', '2', '3', '4', '5']); + $this->assertSame(array_values($this->queryResults), ['1', '2', '3', '4', '5']); // Sorting with 'desc' lower case $this->queryResults = $this->factory->get('config_query_test') ->tableSort($header) ->sort('id', 'desc') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['5', '4', '3', '2', '1']); + $this->assertSame(array_values($this->queryResults), ['5', '4', '3', '2', '1']); // Sorting with 'asc' lower case $this->queryResults = $this->factory->get('config_query_test') ->tableSort($header) ->sort('id', 'asc') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['1', '2', '3', '4', '5']); + $this->assertSame(array_values($this->queryResults), ['1', '2', '3', '4', '5']); // Sort key: number // Sorting with 'DeSc' mixed upper and lower case @@ -521,28 +521,28 @@ public function testTableSort() { ->tableSort($header) ->sort('number', 'DeSc') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['3', '5', '2', '1', '4']); + $this->assertSame(array_values($this->queryResults), ['3', '5', '2', '1', '4']); // Sorting with 'AsC' mixed upper and lower case $this->queryResults = $this->factory->get('config_query_test') ->tableSort($header) ->sort('number', 'AsC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['4', '1', '2', '5', '3']); + $this->assertSame(array_values($this->queryResults), ['4', '1', '2', '5', '3']); // Sorting with 'dEsC' mixed upper and lower case $this->queryResults = $this->factory->get('config_query_test') ->tableSort($header) ->sort('number', 'dEsC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['3', '5', '2', '1', '4']); + $this->assertSame(array_values($this->queryResults), ['3', '5', '2', '1', '4']); // Sorting with 'aSc' mixed upper and lower case $this->queryResults = $this->factory->get('config_query_test') ->tableSort($header) ->sort('number', 'aSc') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['4', '1', '2', '5', '3']); + $this->assertSame(array_values($this->queryResults), ['4', '1', '2', '5', '3']); } /** @@ -655,10 +655,10 @@ public function testLookupKeys() { * Array of expected entity IDs. */ protected function assertResults($expected) { - $this->assertIdentical(count($this->queryResults), count($expected)); + $this->assertSame(count($this->queryResults), count($expected)); foreach ($expected as $value) { // This also tests whether $this->queryResults[$value] is even set at all. - $this->assertIdentical($this->queryResults[$value], $value); + $this->assertSame($this->queryResults[$value], $value); } } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNullStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNullStorageTest.php index 697f1be..6da9bb3 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNullStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNullStorageTest.php @@ -30,10 +30,10 @@ class ContentEntityNullStorageTest extends KernelTestBase { * @see \Drupal\Core\Entity\Query\Null\Query */ public function testEntityQuery() { - $this->assertIdentical(0, \Drupal::entityQuery('contact_message')->count()->execute(), 'Counting a null storage returns 0.'); - $this->assertIdentical([], \Drupal::entityQuery('contact_message')->execute(), 'Querying a null storage returns an empty array.'); - $this->assertIdentical([], \Drupal::entityQuery('contact_message')->condition('contact_form', 'test')->execute(), 'Querying a null storage returns an empty array and conditions are ignored.'); - $this->assertIdentical([], \Drupal::entityQueryAggregate('contact_message')->aggregate('name', 'AVG')->execute(), 'Aggregate querying a null storage returns an empty array'); + $this->assertSame(0, \Drupal::entityQuery('contact_message')->count()->execute(), 'Counting a null storage returns 0.'); + $this->assertSame([], \Drupal::entityQuery('contact_message')->execute(), 'Querying a null storage returns an empty array.'); + $this->assertSame([], \Drupal::entityQuery('contact_message')->condition('contact_form', 'test')->execute(), 'Querying a null storage returns an empty array and conditions are ignored.'); + $this->assertSame([], \Drupal::entityQueryAggregate('contact_message')->aggregate('name', 'AVG')->execute(), 'Aggregate querying a null storage returns an empty array'); } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php index d7644b2..b3d05d7 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php @@ -211,7 +211,7 @@ public function testHooks() { // Test hook_entity_create_access() and hook_ENTITY_TYPE_create_access(). $entity->access('create'); $this->assertEqual($state->get('entity_test_entity_create_access'), TRUE); - $this->assertIdentical($state->get('entity_test_entity_create_access_context'), [ + $this->assertSame($state->get('entity_test_entity_create_access_context'), [ 'entity_type_id' => 'entity_test', 'langcode' => LanguageInterface::LANGCODE_DEFAULT, ]); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php index ca65eb8..c8fc036 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php @@ -66,8 +66,8 @@ public function testEntityReferenceAutocompletion() { // We should get both entities in a JSON encoded string. $input = '10/'; $data = $this->getAutocompleteResult($input); - $this->assertIdentical($data[0]['label'], Html::escape($entity_1->name->value), 'Autocomplete returned the first matching entity'); - $this->assertIdentical($data[1]['label'], Html::escape($entity_2->name->value), 'Autocomplete returned the second matching entity'); + $this->assertSame($data[0]['label'], Html::escape($entity_1->name->value), 'Autocomplete returned the first matching entity'); + $this->assertSame($data[1]['label'], Html::escape($entity_2->name->value), 'Autocomplete returned the second matching entity'); // Try to autocomplete a entity label that matches the first entity. // We should only get the first entity in a JSON encoded string. @@ -77,13 +77,13 @@ public function testEntityReferenceAutocompletion() { 'value' => $entity_1->name->value . ' (1)', 'label' => Html::escape($entity_1->name->value), ]; - $this->assertIdentical(reset($data), $target, 'Autocomplete returns only the expected matching entity.'); + $this->assertSame(reset($data), $target, 'Autocomplete returns only the expected matching entity.'); // Try to autocomplete a entity label that matches the second entity, and // the first entity is already typed in the autocomplete (tags) widget. $input = $entity_1->name->value . ' (1), 10/17'; $data = $this->getAutocompleteResult($input); - $this->assertIdentical($data[0]['label'], Html::escape($entity_2->name->value), 'Autocomplete returned the second matching entity'); + $this->assertSame($data[0]['label'], Html::escape($entity_2->name->value), 'Autocomplete returned the second matching entity'); // Try to autocomplete a entity label with both a comma, a slash and markup. $input = '"label with, and /"'; @@ -95,7 +95,7 @@ public function testEntityReferenceAutocompletion() { 'value' => $n, 'label' => Html::escape($entity_3->name->value), ]; - $this->assertIdentical(reset($data), $target, 'Autocomplete returns an entity label containing a comma and a slash.'); + $this->assertSame(reset($data), $target, 'Autocomplete returns an entity label containing a comma and a slash.'); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php index 646ad2e..4c875e2 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php @@ -87,7 +87,7 @@ public function testNewEntityType() { public function testNoUpdates() { // Ensure that the definition update manager reports no updates. $this->assertFalse($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that no updates are needed.'); - $this->assertIdentical($this->entityDefinitionUpdateManager->getChangeSummary(), [], 'EntityDefinitionUpdateManager reports an empty change summary.'); + $this->assertSame($this->entityDefinitionUpdateManager->getChangeSummary(), [], 'EntityDefinitionUpdateManager reports an empty change summary.'); // Ensure that applyUpdates() runs without error (it's not expected to do // anything when there aren't updates). @@ -281,7 +281,7 @@ public function testBaseFieldCreateDeleteWithExistingEntities() { $schema_handler = $this->database->schema(); $this->assertTrue($schema_handler->fieldExists('entity_test_update', 'new_base_field'), 'Column created in shared table for new_base_field.'); $entity = $this->entityManager->getStorage('entity_test_update')->load($entity->id()); - $this->assertIdentical($entity->name->value, $name, 'Entity data preserved during field creation.'); + $this->assertSame($entity->name->value, $name, 'Entity data preserved during field creation.'); // Remove the base field and run the update. Ensure the base field's column // is deleted and the prior saved entity data is still there. @@ -289,7 +289,7 @@ public function testBaseFieldCreateDeleteWithExistingEntities() { $this->entityDefinitionUpdateManager->applyUpdates(); $this->assertFalse($schema_handler->fieldExists('entity_test_update', 'new_base_field'), 'Column deleted from shared table for new_base_field.'); $entity = $this->entityManager->getStorage('entity_test_update')->load($entity->id()); - $this->assertIdentical($entity->name->value, $name, 'Entity data preserved during field deletion.'); + $this->assertSame($entity->name->value, $name, 'Entity data preserved during field deletion.'); // Add a base field with a required property and run the update. Ensure // 'not null' is not applied and thus no exception is thrown. @@ -338,7 +338,7 @@ public function testBundleFieldCreateDeleteWithExistingEntities() { $schema_handler = $this->database->schema(); $this->assertTrue($schema_handler->tableExists('entity_test_update__new_bundle_field'), 'Dedicated table created for new_bundle_field.'); $entity = $this->entityManager->getStorage('entity_test_update')->load($entity->id()); - $this->assertIdentical($entity->name->value, $name, 'Entity data preserved during field creation.'); + $this->assertSame($entity->name->value, $name, 'Entity data preserved during field creation.'); // Remove the base field and run the update. Ensure the bundle field's // table is deleted and the prior saved entity data is still there. @@ -346,7 +346,7 @@ public function testBundleFieldCreateDeleteWithExistingEntities() { $this->entityDefinitionUpdateManager->applyUpdates(); $this->assertFalse($schema_handler->tableExists('entity_test_update__new_bundle_field'), 'Dedicated table deleted for new_bundle_field.'); $entity = $this->entityManager->getStorage('entity_test_update')->load($entity->id()); - $this->assertIdentical($entity->name->value, $name, 'Entity data preserved during field deletion.'); + $this->assertSame($entity->name->value, $name, 'Entity data preserved during field deletion.'); // Test that required columns are created as 'not null'. $this->addBundleField('shape_required'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php index e0bf655..da5de7e 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php @@ -223,8 +223,8 @@ protected function doTestReadWrite($entity_type) { } $this->assertTrue(isset($entity->name), format_string('%entity_type: Name field is set.', ['%entity_type' => $entity_type])); $this->assertTrue($entity->name->isEmpty(), format_string('%entity_type: Name field is set.', ['%entity_type' => $entity_type])); - $this->assertIdentical(count($entity->name), 0, format_string('%entity_type: Name field contains no items.', ['%entity_type' => $entity_type])); - $this->assertIdentical($entity->name->getValue(), [], format_string('%entity_type: Name field value is an empty array.', ['%entity_type' => $entity_type])); + $this->assertSame(count($entity->name), 0, format_string('%entity_type: Name field contains no items.', ['%entity_type' => $entity_type])); + $this->assertSame($entity->name->getValue(), [], format_string('%entity_type: Name field value is an empty array.', ['%entity_type' => $entity_type])); $this->assertFalse(isset($entity->name[0]), format_string('%entity_type: Name field item is not set.', ['%entity_type' => $entity_type])); $this->assertFalse(isset($entity->name[0]->value), format_string('%entity_type: First name item value is not set.', ['%entity_type' => $entity_type])); $this->assertFalse(isset($entity->name->value), format_string('%entity_type: Name value is not set.', ['%entity_type' => $entity_type])); @@ -342,7 +342,7 @@ protected function doTestReadWrite($entity_type) { 'field_test_text' => $text_item, ]); $this->assertNotNull($entity->user_id->target_id, format_string('%entity_type: User id is not NULL', ['%entity_type' => $entity_type])); - $this->assertIdentical($entity->user_id->target_id, 0, format_string('%entity_type: User id has been set to 0', ['%entity_type' => $entity_type])); + $this->assertSame($entity->user_id->target_id, 0, format_string('%entity_type: User id has been set to 0', ['%entity_type' => $entity_type])); // Test setting the ID with the value only. $entity = $this->container->get('entity_type.manager') @@ -353,7 +353,7 @@ protected function doTestReadWrite($entity_type) { 'field_test_text' => $text_item, ]); $this->assertNotNull($entity->user_id->target_id, format_string('%entity_type: User id is not NULL', ['%entity_type' => $entity_type])); - $this->assertIdentical($entity->user_id->target_id, 0, format_string('%entity_type: User id has been set to 0', ['%entity_type' => $entity_type])); + $this->assertSame($entity->user_id->target_id, 0, format_string('%entity_type: User id has been set to 0', ['%entity_type' => $entity_type])); } /** @@ -471,30 +471,30 @@ protected function doTestIntrospection($entity_type) { // Make sure provided contextual information is right. $entity_adapter = $entity->getTypedData(); - $this->assertIdentical($entity_adapter->getRoot(), $entity_adapter, 'Entity is root object.'); + $this->assertSame($entity_adapter->getRoot(), $entity_adapter, 'Entity is root object.'); $this->assertEqual($entity_adapter->getPropertyPath(), ''); $this->assertEqual($entity_adapter->getName(), ''); $this->assertEqual($entity_adapter->getParent(), NULL); $field = $entity->user_id; - $this->assertIdentical($field->getRoot()->getValue(), $entity, 'Entity is root object.'); - $this->assertIdentical($field->getEntity(), $entity, 'getEntity() returns the entity.'); + $this->assertSame($field->getRoot()->getValue(), $entity, 'Entity is root object.'); + $this->assertSame($field->getEntity(), $entity, 'getEntity() returns the entity.'); $this->assertEqual($field->getPropertyPath(), 'user_id'); $this->assertEqual($field->getName(), 'user_id'); - $this->assertIdentical($field->getParent()->getValue(), $entity, 'Parent object matches.'); + $this->assertSame($field->getParent()->getValue(), $entity, 'Parent object matches.'); $field_item = $field[0]; - $this->assertIdentical($field_item->getRoot()->getValue(), $entity, 'Entity is root object.'); - $this->assertIdentical($field_item->getEntity(), $entity, 'getEntity() returns the entity.'); + $this->assertSame($field_item->getRoot()->getValue(), $entity, 'Entity is root object.'); + $this->assertSame($field_item->getEntity(), $entity, 'getEntity() returns the entity.'); $this->assertEqual($field_item->getPropertyPath(), 'user_id.0'); $this->assertEqual($field_item->getName(), '0'); - $this->assertIdentical($field_item->getParent(), $field, 'Parent object matches.'); + $this->assertSame($field_item->getParent(), $field, 'Parent object matches.'); $item_value = $field_item->get('entity'); - $this->assertIdentical($item_value->getRoot()->getValue(), $entity, 'Entity is root object.'); + $this->assertSame($item_value->getRoot()->getValue(), $entity, 'Entity is root object.'); $this->assertEqual($item_value->getPropertyPath(), 'user_id.0.entity'); $this->assertEqual($item_value->getName(), 'entity'); - $this->assertIdentical($item_value->getParent(), $field_item, 'Parent object matches.'); + $this->assertSame($item_value->getParent(), $field_item, 'Parent object matches.'); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php index 5c7e51c..76a5b22 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php @@ -287,21 +287,21 @@ public function testEntityQuery() { // This matches both the original and new current revisions, multiple // revisions are returned for some entities. $assert = [16 => '4', 17 => '5', 18 => '6', 19 => '7', 8 => '8', 9 => '9', 10 => '10', 11 => '11', 20 => '12', 21 => '13', 22 => '14', 23 => '15']; - $this->assertIdentical($results, $assert); + $this->assertSame($results, $assert); $results = $this->factory->get('entity_test_mulrev') ->condition("$greetings.value", 'siema', 'STARTS_WITH') ->sort('revision_id') ->execute(); // Now we only get the ones that originally were siema, entity id 8 and // above. - $this->assertIdentical($results, array_slice($assert, 4, 8, TRUE)); + $this->assertSame($results, array_slice($assert, 4, 8, TRUE)); $results = $this->factory->get('entity_test_mulrev') ->condition("$greetings.value", 'a', 'ENDS_WITH') ->sort('revision_id') ->execute(); // It is very important that we do not get the ones which only have // xsiemax despite originally they were merhaba, ie. ended with a. - $this->assertIdentical($results, array_slice($assert, 4, 8, TRUE)); + $this->assertSame($results, array_slice($assert, 4, 8, TRUE)); $results = $this->factory->get('entity_test_mulrev') ->condition("$greetings.value", 'a', 'ENDS_WITH') ->allRevisions() @@ -310,7 +310,7 @@ public function testEntityQuery() { ->execute(); // Now we get everything. $assert = [4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9', 10 => '10', 11 => '11', 12 => '12', 20 => '12', 13 => '13', 21 => '13', 14 => '14', 22 => '14', 15 => '15', 23 => '15']; - $this->assertIdentical($results, $assert); + $this->assertSame($results, $assert); } /** @@ -604,7 +604,7 @@ protected function assertResult() { foreach ($expected as $binary) { $assert[$binary] = strval($binary); } - $this->assertIdentical($this->queryResults, $assert); + $this->assertSame($this->queryResults, $assert); } protected function assertRevisionResult($keys, $expected) { @@ -612,7 +612,7 @@ protected function assertRevisionResult($keys, $expected) { foreach ($expected as $key => $binary) { $assert[$keys[$key]] = strval($binary); } - $this->assertIdentical($this->queryResults, $assert); + $this->assertSame($this->queryResults, $assert); return $assert; } @@ -720,110 +720,110 @@ public function testCaseSensitivity() { $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_ci', $fixtures[0]['lowercase'] . $fixtures[1]['lowercase'] )->execute(); - $this->assertIdentical(count($result), 1, 'Case insensitive, lowercase'); + $this->assertSame(count($result), 1, 'Case insensitive, lowercase'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_ci', $fixtures[0]['uppercase'] . $fixtures[1]['uppercase'] )->execute(); - $this->assertIdentical(count($result), 1, 'Case insensitive, uppercase'); + $this->assertSame(count($result), 1, 'Case insensitive, uppercase'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_ci', $fixtures[0]['uppercase'] . $fixtures[1]['lowercase'] )->execute(); - $this->assertIdentical(count($result), 1, 'Case insensitive, mixed.'); + $this->assertSame(count($result), 1, 'Case insensitive, mixed.'); // Check the case sensitive field, = operator. $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_cs', $fixtures[0]['lowercase'] . $fixtures[1]['lowercase'] )->execute(); - $this->assertIdentical(count($result), 0, 'Case sensitive, lowercase.'); + $this->assertSame(count($result), 0, 'Case sensitive, lowercase.'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_cs', $fixtures[0]['uppercase'] . $fixtures[1]['uppercase'] )->execute(); - $this->assertIdentical(count($result), 0, 'Case sensitive, uppercase.'); + $this->assertSame(count($result), 0, 'Case sensitive, uppercase.'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_cs', $fixtures[0]['uppercase'] . $fixtures[1]['lowercase'] )->execute(); - $this->assertIdentical(count($result), 1, 'Case sensitive, exact match.'); + $this->assertSame(count($result), 1, 'Case sensitive, exact match.'); // Check the case insensitive field, IN operator. $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_ci', [$fixtures[0]['lowercase'] . $fixtures[1]['lowercase']], 'IN' )->execute(); - $this->assertIdentical(count($result), 1, 'Case insensitive, lowercase'); + $this->assertSame(count($result), 1, 'Case insensitive, lowercase'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_ci', [$fixtures[0]['uppercase'] . $fixtures[1]['uppercase']], 'IN' )->execute(); - $this->assertIdentical(count($result), 1, 'Case insensitive, uppercase'); + $this->assertSame(count($result), 1, 'Case insensitive, uppercase'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_ci', [$fixtures[0]['uppercase'] . $fixtures[1]['lowercase']], 'IN' )->execute(); - $this->assertIdentical(count($result), 1, 'Case insensitive, mixed'); + $this->assertSame(count($result), 1, 'Case insensitive, mixed'); // Check the case sensitive field, IN operator. $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_cs', [$fixtures[0]['lowercase'] . $fixtures[1]['lowercase']], 'IN' )->execute(); - $this->assertIdentical(count($result), 0, 'Case sensitive, lowercase'); + $this->assertSame(count($result), 0, 'Case sensitive, lowercase'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_cs', [$fixtures[0]['uppercase'] . $fixtures[1]['uppercase']], 'IN' )->execute(); - $this->assertIdentical(count($result), 0, 'Case sensitive, uppercase'); + $this->assertSame(count($result), 0, 'Case sensitive, uppercase'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_cs', [$fixtures[0]['uppercase'] . $fixtures[1]['lowercase']], 'IN' )->execute(); - $this->assertIdentical(count($result), 1, 'Case sensitive, mixed'); + $this->assertSame(count($result), 1, 'Case sensitive, mixed'); // Check the case insensitive field, STARTS_WITH operator. $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_ci', $fixtures[0]['lowercase'], 'STARTS_WITH' )->execute(); - $this->assertIdentical(count($result), 1, 'Case sensitive, lowercase.'); + $this->assertSame(count($result), 1, 'Case sensitive, lowercase.'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_ci', $fixtures[0]['uppercase'], 'STARTS_WITH' )->execute(); - $this->assertIdentical(count($result), 1, 'Case sensitive, exact match.'); + $this->assertSame(count($result), 1, 'Case sensitive, exact match.'); // Check the case sensitive field, STARTS_WITH operator. $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_cs', $fixtures[0]['lowercase'], 'STARTS_WITH' )->execute(); - $this->assertIdentical(count($result), 0, 'Case sensitive, lowercase.'); + $this->assertSame(count($result), 0, 'Case sensitive, lowercase.'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_cs', $fixtures[0]['uppercase'], 'STARTS_WITH' )->execute(); - $this->assertIdentical(count($result), 1, 'Case sensitive, exact match.'); + $this->assertSame(count($result), 1, 'Case sensitive, exact match.'); // Check the case insensitive field, ENDS_WITH operator. $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_ci', $fixtures[1]['lowercase'], 'ENDS_WITH' )->execute(); - $this->assertIdentical(count($result), 1, 'Case sensitive, lowercase.'); + $this->assertSame(count($result), 1, 'Case sensitive, lowercase.'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_ci', $fixtures[1]['uppercase'], 'ENDS_WITH' )->execute(); - $this->assertIdentical(count($result), 1, 'Case sensitive, exact match.'); + $this->assertSame(count($result), 1, 'Case sensitive, exact match.'); // Check the case sensitive field, ENDS_WITH operator. $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_cs', $fixtures[1]['lowercase'], 'ENDS_WITH' )->execute(); - $this->assertIdentical(count($result), 1, 'Case sensitive, lowercase.'); + $this->assertSame(count($result), 1, 'Case sensitive, lowercase.'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_cs', $fixtures[1]['uppercase'], 'ENDS_WITH' )->execute(); - $this->assertIdentical(count($result), 0, 'Case sensitive, exact match.'); + $this->assertSame(count($result), 0, 'Case sensitive, exact match.'); // Check the case insensitive field, CONTAINS operator, use the inner 8 @@ -831,23 +831,23 @@ public function testCaseSensitivity() { $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_ci', Unicode::substr($fixtures[0]['uppercase'] . $fixtures[1]['lowercase'], 4, 8), 'CONTAINS' )->execute(); - $this->assertIdentical(count($result), 1, 'Case sensitive, lowercase.'); + $this->assertSame(count($result), 1, 'Case sensitive, lowercase.'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_ci', Unicode::strtolower(Unicode::substr($fixtures[0]['uppercase'] . $fixtures[1]['lowercase'], 4, 8)), 'CONTAINS' )->execute(); - $this->assertIdentical(count($result), 1, 'Case sensitive, exact match.'); + $this->assertSame(count($result), 1, 'Case sensitive, exact match.'); // Check the case sensitive field, CONTAINS operator. $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_cs', Unicode::substr($fixtures[0]['uppercase'] . $fixtures[1]['lowercase'], 4, 8), 'CONTAINS' )->execute(); - $this->assertIdentical(count($result), 1, 'Case sensitive, lowercase.'); + $this->assertSame(count($result), 1, 'Case sensitive, lowercase.'); $result = \Drupal::entityQuery('entity_test_mulrev')->condition( 'field_cs', Unicode::strtolower(Unicode::substr($fixtures[0]['uppercase'] . $fixtures[1]['lowercase'], 4, 8)), 'CONTAINS' )->execute(); - $this->assertIdentical(count($result), 0, 'Case sensitive, exact match.'); + $this->assertSame(count($result), 0, 'Case sensitive, exact match.'); } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php index eb13d0e..b9951ad 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php @@ -114,7 +114,7 @@ public function testSort() { $nodes['published2']->id() => $node_labels['published2'], $nodes['published1']->id() => $node_labels['published1'], ]; - $this->assertIdentical($result['article'], $expected_result, 'Query sorted by field returned expected values.'); + $this->assertSame($result['article'], $expected_result, 'Query sorted by field returned expected values.'); // Assert sort by base field. $selection_options['handler_settings']['sort'] = [ @@ -127,7 +127,7 @@ public function testSort() { $nodes['published1']->id() => $node_labels['published1'], $nodes['published2']->id() => $node_labels['published2'], ]; - $this->assertIdentical($result['article'], $expected_result, 'Query sorted by property returned expected values.'); + $this->assertSame($result['article'], $expected_result, 'Query sorted by property returned expected values.'); } } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php index fe8bcc0..bcd702a 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php @@ -341,12 +341,12 @@ protected function doTestEntityTranslationAPI($entity_type) { // retrieve a translation referring to it. $translation = $entity->getTranslation(LanguageInterface::LANGCODE_NOT_SPECIFIED); $this->assertFalse($translation->isNewTranslation(), 'Existing translations are not marked as new.'); - $this->assertIdentical($entity, $translation, 'The translation object corresponding to a non-default language is the entity object itself when the entity is language-neutral.'); + $this->assertSame($entity, $translation, 'The translation object corresponding to a non-default language is the entity object itself when the entity is language-neutral.'); $entity->{$langcode_key}->value = $default_langcode; $translation = $entity->getTranslation($default_langcode); - $this->assertIdentical($entity, $translation, 'The translation object corresponding to the default language (explicit) is the entity object itself.'); + $this->assertSame($entity, $translation, 'The translation object corresponding to the default language (explicit) is the entity object itself.'); $translation = $entity->getTranslation(LanguageInterface::LANGCODE_DEFAULT); - $this->assertIdentical($entity, $translation, 'The translation object corresponding to the default language (implicit) is the entity object itself.'); + $this->assertSame($entity, $translation, 'The translation object corresponding to the default language (implicit) is the entity object itself.'); $this->assertTrue($entity->{$default_langcode_key}->value, 'The translation object is the default one.'); // Verify that trying to retrieve a translation for a locked language when @@ -657,7 +657,7 @@ protected function doTestLanguageFallback($entity_type) { $translation = $this->entityManager->getTranslationFromContext($entity2, $default_langcode); $translation_build = $controller->view($translation); $translation_output = (string) $renderer->renderRoot($translation_build); - $this->assertIdentical($entity2_output, $translation_output, 'When the entity has no translation no fallback is applied.'); + $this->assertSame($entity2_output, $translation_output, 'When the entity has no translation no fallback is applied.'); // Checks that entity translations are rendered properly. $controller = $this->entityManager->getViewBuilder($entity_type); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php index a3466a4..f65fbf2 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php @@ -46,7 +46,7 @@ protected function assertCRUD($entity_type) { 'name' => $this->randomMachineName(), 'uuid' => $uuid, ]); - $this->assertIdentical($custom_entity->uuid(), $uuid); + $this->assertSame($custom_entity->uuid(), $uuid); // Save this entity, so we have more than one later. $custom_entity->save(); @@ -62,7 +62,7 @@ protected function assertCRUD($entity_type) { // Verify that the UUID is retained upon saving. $entity->save(); - $this->assertIdentical($entity->uuid(), $uuid); + $this->assertSame($entity->uuid(), $uuid); // Verify that the UUID is retained upon loading. /** @var \Drupal\Core\Entity\EntityStorageInterface $storage */ @@ -70,11 +70,11 @@ protected function assertCRUD($entity_type) { ->getStorage($entity_type); $storage->resetCache([$entity->id()]); $entity_loaded = $storage->load($entity->id()); - $this->assertIdentical($entity_loaded->uuid(), $uuid); + $this->assertSame($entity_loaded->uuid(), $uuid); // Verify that \Drupal::entityManager()->loadEntityByUuid() loads the same entity. $entity_loaded_by_uuid = \Drupal::entityManager()->loadEntityByUuid($entity_type, $uuid, TRUE); - $this->assertIdentical($entity_loaded_by_uuid->uuid(), $uuid); + $this->assertSame($entity_loaded_by_uuid->uuid(), $uuid); $this->assertEqual($entity_loaded_by_uuid->id(), $entity_loaded->id()); // Creating a duplicate needs to result in a new UUID. diff --git a/core/tests/Drupal/KernelTests/Core/EventSubscriber/IgnoreReplicaSubscriberTest.php b/core/tests/Drupal/KernelTests/Core/EventSubscriber/IgnoreReplicaSubscriberTest.php index 4206cea..7ce994a 100644 --- a/core/tests/Drupal/KernelTests/Core/EventSubscriber/IgnoreReplicaSubscriberTest.php +++ b/core/tests/Drupal/KernelTests/Core/EventSubscriber/IgnoreReplicaSubscriberTest.php @@ -37,7 +37,7 @@ public function testSystemInitIgnoresSecondaries() { $db1 = Database::getConnection('default', 'default'); $db2 = Database::getConnection('replica', 'default'); - $this->assertIdentical($db1, $db2, 'System Init ignores secondaries when requested.'); + $this->assertSame($db1, $db2, 'System Init ignores secondaries when requested.'); } } diff --git a/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php b/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php index 0c4c1eb..7426775 100644 --- a/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php @@ -82,7 +82,7 @@ public function testHtaccessSave() { */ protected function assertFilePermissions($uri, $expected) { $actual = fileperms($uri) & 0777; - return $this->assertIdentical($actual, $expected, SafeMarkup::format('@uri file permissions @actual are identical to @expected.', [ + return $this->assertSame($actual, $expected, SafeMarkup::format('@uri file permissions @actual are identical to @expected.', [ '@uri' => $uri, '@actual' => 0 . decoct($actual), '@expected' => 0 . decoct($expected), diff --git a/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php b/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php index 05ac7c2..901f6d8 100644 --- a/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php @@ -45,12 +45,12 @@ public function testFileMimeTypeDetection() { // Test stream [URI]. foreach ($prefixes as $prefix) { $output = $guesser->guess($prefix . $input); - $this->assertIdentical($output, $expected, format_string('Mimetype for %input is %output (expected: %expected).', ['%input' => $prefix . $input, '%output' => $output, '%expected' => $expected])); + $this->assertSame($output, $expected, format_string('Mimetype for %input is %output (expected: %expected).', ['%input' => $prefix . $input, '%output' => $output, '%expected' => $expected])); } // Test normal path equivalent $output = $guesser->guess($input); - $this->assertIdentical($output, $expected, format_string('Mimetype (using default mappings) for %input is %output (expected: %expected).', ['%input' => $input, '%output' => $output, '%expected' => $expected])); + $this->assertSame($output, $expected, format_string('Mimetype (using default mappings) for %input is %output (expected: %expected).', ['%input' => $input, '%output' => $output, '%expected' => $expected])); } // Now test the extension gusser by passing in a custom mapping. @@ -85,7 +85,7 @@ public function testFileMimeTypeDetection() { foreach ($test_case as $input => $expected) { $output = $extension_guesser->guess($input); - $this->assertIdentical($output, $expected, format_string('Mimetype (using passed-in mappings) for %input is %output (expected: %expected).', ['%input' => $input, '%output' => $output, '%expected' => $expected])); + $this->assertSame($output, $expected, format_string('Mimetype (using passed-in mappings) for %input is %output (expected: %expected).', ['%input' => $input, '%output' => $output, '%expected' => $expected])); } } diff --git a/core/tests/Drupal/KernelTests/Core/File/NameMungingTest.php b/core/tests/Drupal/KernelTests/Core/File/NameMungingTest.php index 422f294..2e5d094 100644 --- a/core/tests/Drupal/KernelTests/Core/File/NameMungingTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/NameMungingTest.php @@ -59,7 +59,7 @@ public function testMungeNullByte() { public function testMungeIgnoreInsecure() { $this->config('system.file')->set('allow_insecure_uploads', 1)->save(); $munged_name = file_munge_filename($this->name, ''); - $this->assertIdentical($munged_name, $this->name, format_string('The original filename (%original) matches the munged filename (%munged) when insecure uploads are enabled.', ['%munged' => $munged_name, '%original' => $this->name])); + $this->assertSame($munged_name, $this->name, format_string('The original filename (%original) matches the munged filename (%munged) when insecure uploads are enabled.', ['%munged' => $munged_name, '%original' => $this->name])); } /** @@ -69,10 +69,10 @@ public function testMungeIgnoreWhitelisted() { // Declare our extension as whitelisted. The declared extensions should // be case insensitive so test using one with a different case. $munged_name = file_munge_filename($this->nameWithUcExt, $this->badExtension); - $this->assertIdentical($munged_name, $this->nameWithUcExt, format_string('The new filename (%munged) matches the original (%original) once the extension has been whitelisted.', ['%munged' => $munged_name, '%original' => $this->nameWithUcExt])); + $this->assertSame($munged_name, $this->nameWithUcExt, format_string('The new filename (%munged) matches the original (%original) once the extension has been whitelisted.', ['%munged' => $munged_name, '%original' => $this->nameWithUcExt])); // The allowed extensions should also be normalized. $munged_name = file_munge_filename($this->name, strtoupper($this->badExtension)); - $this->assertIdentical($munged_name, $this->name, format_string('The new filename (%munged) matches the original (%original) also when the whitelisted extension is in uppercase.', ['%munged' => $munged_name, '%original' => $this->name])); + $this->assertSame($munged_name, $this->name, format_string('The new filename (%munged) matches the original (%original) also when the whitelisted extension is in uppercase.', ['%munged' => $munged_name, '%original' => $this->name])); } /** @@ -81,7 +81,7 @@ public function testMungeIgnoreWhitelisted() { public function testUnMunge() { $munged_name = file_munge_filename($this->name, '', FALSE); $unmunged_name = file_unmunge_filename($munged_name); - $this->assertIdentical($unmunged_name, $this->name, format_string('The unmunged (%unmunged) filename matches the original (%original)', ['%unmunged' => $unmunged_name, '%original' => $this->name])); + $this->assertSame($unmunged_name, $this->name, format_string('The unmunged (%unmunged) filename matches the original (%original)', ['%unmunged' => $unmunged_name, '%original' => $this->name])); } } diff --git a/core/tests/Drupal/KernelTests/Core/File/UrlRewritingTest.php b/core/tests/Drupal/KernelTests/Core/File/UrlRewritingTest.php index 35d2ca0..bdf66bd 100644 --- a/core/tests/Drupal/KernelTests/Core/File/UrlRewritingTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/UrlRewritingTest.php @@ -106,13 +106,13 @@ public function testRelativeFileURL() { // Shipped file. $filepath = 'core/assets/vendor/jquery/jquery.min.js'; $url = file_create_url($filepath); - $this->assertIdentical(base_path() . $filepath, file_url_transform_relative($url)); + $this->assertSame(base_path() . $filepath, file_url_transform_relative($url)); // Managed file. $uri = $this->createUri(); $url = file_create_url($uri); $public_directory_path = \Drupal::service('stream_wrapper_manager')->getViaScheme('public')->getDirectoryPath(); - $this->assertIdentical(base_path() . $public_directory_path . '/' . rawurlencode(drupal_basename($uri)), file_url_transform_relative($url)); + $this->assertSame(base_path() . $public_directory_path . '/' . rawurlencode(drupal_basename($uri)), file_url_transform_relative($url)); } } diff --git a/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php b/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php index 6d79f17..628b82a 100644 --- a/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php +++ b/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php @@ -92,13 +92,13 @@ public function testDefaultAndCustomHandlers() { $handlers = $form_state->get('test_handlers'); - $this->assertIdentical(count($handlers['validate']), 2); - $this->assertIdentical($handlers['validate'][0], 'customValidateForm'); - $this->assertIdentical($handlers['validate'][1], 'validateForm'); + $this->assertSame(count($handlers['validate']), 2); + $this->assertSame($handlers['validate'][0], 'customValidateForm'); + $this->assertSame($handlers['validate'][1], 'validateForm'); - $this->assertIdentical(count($handlers['submit']), 2); - $this->assertIdentical($handlers['submit'][0], 'customSubmitForm'); - $this->assertIdentical($handlers['submit'][1], 'submitForm'); + $this->assertSame(count($handlers['submit']), 2); + $this->assertSame($handlers['submit'][0], 'customSubmitForm'); + $this->assertSame($handlers['submit'][1], 'submitForm'); } } diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php index 2d543cb..db63215 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php @@ -78,7 +78,7 @@ public function testCRUDWithExpiration() { // Ensure that an item with the same name exists in the other collection. $stores[1]->set('foo', $this->objects[5]); $result = $stores[0]->getAll(); - // Not using assertIdentical(), since the order is not defined for getAll(). + // Not using assertSame(), since the order is not defined for getAll(). $this->assertEqual(count($result), count($values)); foreach ($result as $key => $value) { $this->assertEqual($values[$key], $value); @@ -131,8 +131,8 @@ public function testExpiration() { $this->assertFalse($stores[0]->has('yesterday')); $this->assertFalse($stores[0]->get('yesterday')); $this->assertTrue($stores[0]->has('troubles')); - $this->assertIdentical($stores[0]->get('troubles'), 'here to stay'); - $this->assertIdentical(count($stores[0]->getMultiple(['yesterday', 'troubles'])), 1); + $this->assertSame($stores[0]->get('troubles'), 'here to stay'); + $this->assertSame(count($stores[0]->getMultiple(['yesterday', 'troubles'])), 1); // Store items set to expire in the past in various ways. $stores[0]->setWithExpire($this->randomMachineName(), $this->objects[0], -7 * $day); @@ -149,7 +149,7 @@ public function testExpiration() { // Ensure only non-expired items are retrieved. $all = $stores[0]->getAll(); - $this->assertIdentical(count($all), 2); + $this->assertSame(count($all), 2); foreach (['troubles', 'still'] as $key) { $this->assertTrue(!empty($all[$key])); } diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php index e0badd8..fb51718 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php @@ -39,7 +39,7 @@ public function testGarbageCollection() { for ($i = 0; $i <= 3; $i++) { $store->setWithExpire('key_' . $i, $this->randomObject(), rand(500, 100000)); } - $this->assertIdentical(sizeof($store->getAll()), 4, 'Four items were written to the storage.'); + $this->assertSame(sizeof($store->getAll()), 4, 'Four items were written to the storage.'); // Manually expire the data. for ($i = 0; $i <= 3; $i++) { @@ -65,7 +65,7 @@ public function testGarbageCollection() { [ ':collection' => $collection, ])->fetchAll(); - $this->assertIdentical(count($result), 1, 'Only one item remains after garbage collection'); + $this->assertSame(count($result), 1, 'Only one item remains after garbage collection'); } diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php index 31300db..777fa43 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php @@ -36,20 +36,20 @@ public function testCRUD() { $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId(); // Verify default properties on a newly created empty entity. $empty = EntityTestLabel::create(); - $this->assertIdentical($empty->id->value, NULL); - $this->assertIdentical($empty->name->value, NULL); + $this->assertSame($empty->id->value, NULL); + $this->assertSame($empty->name->value, NULL); $this->assertTrue($empty->uuid->value); - $this->assertIdentical($empty->langcode->value, $default_langcode); + $this->assertSame($empty->langcode->value, $default_langcode); // Verify ConfigEntity properties/methods on the newly created empty entity. - $this->assertIdentical($empty->isNew(), TRUE); - $this->assertIdentical($empty->bundle(), 'entity_test_label'); - $this->assertIdentical($empty->id(), NULL); + $this->assertSame($empty->isNew(), TRUE); + $this->assertSame($empty->bundle(), 'entity_test_label'); + $this->assertSame($empty->id(), NULL); $this->assertTrue($empty->uuid()); - $this->assertIdentical($empty->label(), NULL); + $this->assertSame($empty->label(), NULL); // Verify Entity properties/methods on the newly created empty entity. - $this->assertIdentical($empty->getEntityTypeId(), 'entity_test_label'); + $this->assertSame($empty->getEntityTypeId(), 'entity_test_label'); // The URI can only be checked after saving. try { $empty->urlInfo(); @@ -72,7 +72,7 @@ public function testCRUD() { $empty_id = EntityTestLabel::create([ 'id' => '', ]); - $this->assertIdentical($empty_id->isNew(), TRUE); + $this->assertSame($empty_id->isNew(), TRUE); try { $empty_id->save(); $this->fail('EntityMalformedException was thrown.'); @@ -86,18 +86,18 @@ public function testCRUD() { 'id' => $this->randomMachineName(), 'name' => $this->randomString(), ]); - $this->assertIdentical($entity_test->id->value, $expected['id']); + $this->assertSame($entity_test->id->value, $expected['id']); $this->assertTrue($entity_test->uuid->value); $this->assertNotEqual($entity_test->uuid->value, $empty->uuid->value); - $this->assertIdentical($entity_test->name->value, $expected['name']); - $this->assertIdentical($entity_test->langcode->value, $default_langcode); + $this->assertSame($entity_test->name->value, $expected['name']); + $this->assertSame($entity_test->langcode->value, $default_langcode); // Verify methods on the newly created entity. - $this->assertIdentical($entity_test->isNew(), TRUE); - $this->assertIdentical($entity_test->id(), $expected['id']); + $this->assertSame($entity_test->isNew(), TRUE); + $this->assertSame($entity_test->id(), $expected['id']); $this->assertTrue($entity_test->uuid()); $expected['uuid'] = $entity_test->uuid(); - $this->assertIdentical($entity_test->label(), $expected['name']); + $this->assertSame($entity_test->label(), $expected['name']); // Verify that the entity can be saved. try { @@ -109,26 +109,26 @@ public function testCRUD() { } // Verify that the correct status is returned and properties did not change. - $this->assertIdentical($status, SAVED_NEW); - $this->assertIdentical($entity_test->id(), $expected['id']); - $this->assertIdentical($entity_test->uuid(), $expected['uuid']); - $this->assertIdentical($entity_test->label(), $expected['name']); - $this->assertIdentical($entity_test->isNew(), FALSE); + $this->assertSame($status, SAVED_NEW); + $this->assertSame($entity_test->id(), $expected['id']); + $this->assertSame($entity_test->uuid(), $expected['uuid']); + $this->assertSame($entity_test->label(), $expected['name']); + $this->assertSame($entity_test->isNew(), FALSE); // Save again, and verify correct status and properties again. $status = $entity_test->save(); - $this->assertIdentical($status, SAVED_UPDATED); - $this->assertIdentical($entity_test->id(), $expected['id']); - $this->assertIdentical($entity_test->uuid(), $expected['uuid']); - $this->assertIdentical($entity_test->label(), $expected['name']); - $this->assertIdentical($entity_test->isNew(), FALSE); + $this->assertSame($status, SAVED_UPDATED); + $this->assertSame($entity_test->id(), $expected['id']); + $this->assertSame($entity_test->uuid(), $expected['uuid']); + $this->assertSame($entity_test->label(), $expected['name']); + $this->assertSame($entity_test->isNew(), FALSE); // Ensure that creating an entity with the same id as an existing one is not // possible. $same_id = EntityTestLabel::create([ 'id' => $entity_test->id(), ]); - $this->assertIdentical($same_id->isNew(), TRUE); + $this->assertSame($same_id->isNew(), TRUE); try { $same_id->save(); $this->fail('Not possible to overwrite an entity entity.'); @@ -143,17 +143,17 @@ public function testCRUD() { $old_id = $ids[$i - 1]; $new_id = $ids[$i]; // Before renaming, everything should point to the current ID. - $this->assertIdentical($entity_test->id(), $old_id); + $this->assertSame($entity_test->id(), $old_id); // Rename. $entity_test->id = $new_id; - $this->assertIdentical($entity_test->id(), $new_id); + $this->assertSame($entity_test->id(), $new_id); $status = $entity_test->save(); - $this->assertIdentical($status, SAVED_UPDATED); - $this->assertIdentical($entity_test->isNew(), FALSE); + $this->assertSame($status, SAVED_UPDATED); + $this->assertSame($entity_test->isNew(), FALSE); // Verify that originalID points to new ID directly after renaming. - $this->assertIdentical($entity_test->id(), $new_id); + $this->assertSame($entity_test->id(), $new_id); } } diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php index 7651234..19dd2a5 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php @@ -48,8 +48,8 @@ protected function setUp() { public function testCRUD() { $stores = $this->createStorage(); // Verify that each store returns its own collection name. - $this->assertIdentical($stores[0]->getCollectionName(), $this->collections[0]); - $this->assertIdentical($stores[1]->getCollectionName(), $this->collections[1]); + $this->assertSame($stores[0]->getCollectionName(), $this->collections[0]); + $this->assertSame($stores[1]->getCollectionName(), $this->collections[1]); // Verify that an item can be stored. $stores[0]->set('foo', $this->objects[0]); @@ -102,7 +102,7 @@ public function testCRUD() { // Ensure that an item with the same name exists in the other collection. $stores[1]->set('foo', $this->objects[5]); $result = $stores[0]->getAll(); - // Not using assertIdentical(), since the order is not defined for getAll(). + // Not using assertSame(), since the order is not defined for getAll(). $this->assertEqual(count($result), count($values)); foreach ($result as $key => $value) { $this->assertEqual($values[$key], $value); @@ -134,11 +134,11 @@ public function testNonExistingKeys() { $this->assertNull($stores[0]->get('foo')); // Verify that a non-existing key with a default returns the default. - $this->assertIdentical($stores[0]->get('foo', 'bar'), 'bar'); + $this->assertSame($stores[0]->get('foo', 'bar'), 'bar'); // Verify that a FALSE value can be stored. $stores[0]->set('foo', FALSE); - $this->assertIdentical($stores[0]->get('foo'), FALSE); + $this->assertSame($stores[0]->get('foo'), FALSE); // Verify that a deleted key returns NULL as value. $stores[0]->delete('foo'); @@ -148,7 +148,7 @@ public function testNonExistingKeys() { $stores[0]->set('bar', 'baz'); $values = $stores[0]->getMultiple(['foo', 'bar']); $this->assertFalse(isset($values['foo']), "Key 'foo' not found."); - $this->assertIdentical($values['bar'], 'baz'); + $this->assertSame($values['bar'], 'baz'); } /** @@ -185,9 +185,9 @@ public function testRename() { $store = $stores[0]; $store->set('old', 'thing'); - $this->assertIdentical($store->get('old'), 'thing'); + $this->assertSame($store->get('old'), 'thing'); $store->rename('old', 'new'); - $this->assertIdentical($store->get('new'), 'thing'); + $this->assertSame($store->get('new'), 'thing'); $this->assertNull($store->get('old')); } diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php index bd3bba5..a9ec4b8 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php @@ -59,7 +59,7 @@ public function testContext() { $plugin->getContextValue('user'); } catch (ContextException $e) { - $this->assertIdentical("The 'entity:user' context is required and not present.", $e->getMessage(), 'Requesting a non-set value of a required context should throw a context exception.'); + $this->assertSame("The 'entity:user' context is required and not present.", $e->getMessage(), 'Requesting a non-set value of a required context should throw a context exception.'); } // Try to pass the wrong class type as a context value. diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php index 251abbf..3ee200f 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php @@ -24,9 +24,9 @@ public function testDerivativeDecorator() { // Ensure that NULL is returned as the definition of a non-existing base // plugin, a non-existing derivative plugin, or a base plugin that may not // be used without deriving. - $this->assertIdentical($this->mockBlockManager->getDefinition('non_existing', FALSE), NULL, 'NULL returned as the definition of a non-existing base plugin.'); - $this->assertIdentical($this->mockBlockManager->getDefinition('menu:non_existing', FALSE), NULL, 'NULL returned as the definition of a non-existing derivative plugin.'); - $this->assertIdentical($this->mockBlockManager->getDefinition('menu', FALSE), NULL, 'NULL returned as the definition of a base plugin that may not be used without deriving.'); + $this->assertSame($this->mockBlockManager->getDefinition('non_existing', FALSE), NULL, 'NULL returned as the definition of a non-existing base plugin.'); + $this->assertSame($this->mockBlockManager->getDefinition('menu:non_existing', FALSE), NULL, 'NULL returned as the definition of a non-existing derivative plugin.'); + $this->assertSame($this->mockBlockManager->getDefinition('menu', FALSE), NULL, 'NULL returned as the definition of a base plugin that may not be used without deriving.'); } } diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php index a3492ed..1210c05 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php @@ -51,10 +51,10 @@ public function testDiscoveryInterface() { } // Ensure that an empty array is returned if no plugin definitions are found. - $this->assertIdentical($this->emptyDiscovery->getDefinitions(), [], 'array() returned if no plugin definitions are found.'); + $this->assertSame($this->emptyDiscovery->getDefinitions(), [], 'array() returned if no plugin definitions are found.'); // Ensure that NULL is returned as the definition of a non-existing plugin. - $this->assertIdentical($this->emptyDiscovery->getDefinition('non_existing', FALSE), NULL, 'NULL returned as the definition of a non-existing plugin.'); + $this->assertSame($this->emptyDiscovery->getDefinition('non_existing', FALSE), NULL, 'NULL returned as the definition of a non-existing plugin.'); } /** @@ -78,7 +78,7 @@ protected function assertDefinitionIdentical(array $definition, array $expected_ }; array_walk_recursive($definition, $func); array_walk_recursive($expected_definition, $func); - return $this->assertIdentical($definition, $expected_definition); + return $this->assertSame($definition, $expected_definition); } } diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php index 50da5cf..5425ec5 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php @@ -17,8 +17,8 @@ class FactoryTest extends PluginTestBase { public function testDefaultFactory() { // Ensure a non-derivative plugin can be instantiated. $plugin = $this->testPluginManager->createInstance('user_login', ['title' => 'Please enter your login name and password']); - $this->assertIdentical(get_class($plugin), 'Drupal\plugin_test\Plugin\plugin_test\mock_block\MockUserLoginBlock', 'Correct plugin class instantiated with default factory.'); - $this->assertIdentical($plugin->getTitle(), 'Please enter your login name and password', 'Plugin instance correctly configured.'); + $this->assertSame(get_class($plugin), 'Drupal\plugin_test\Plugin\plugin_test\mock_block\MockUserLoginBlock', 'Correct plugin class instantiated with default factory.'); + $this->assertSame($plugin->getTitle(), 'Please enter your login name and password', 'Plugin instance correctly configured.'); // Ensure that attempting to instantiate non-existing plugins throws a // PluginException. @@ -47,12 +47,12 @@ public function testDefaultFactory() { public function testReflectionFactory() { // Ensure a non-derivative plugin can be instantiated. $plugin = $this->mockBlockManager->createInstance('user_login', ['title' => 'Please enter your login name and password']); - $this->assertIdentical(get_class($plugin), 'Drupal\plugin_test\Plugin\plugin_test\mock_block\MockUserLoginBlock', 'Correct plugin class instantiated.'); - $this->assertIdentical($plugin->getTitle(), 'Please enter your login name and password', 'Plugin instance correctly configured.'); + $this->assertSame(get_class($plugin), 'Drupal\plugin_test\Plugin\plugin_test\mock_block\MockUserLoginBlock', 'Correct plugin class instantiated.'); + $this->assertSame($plugin->getTitle(), 'Please enter your login name and password', 'Plugin instance correctly configured.'); // Ensure a derivative plugin can be instantiated. $plugin = $this->mockBlockManager->createInstance('menu:main_menu', ['depth' => 2]); - $this->assertIdentical($plugin->getContent(), ' ', 'Derived plugin instance correctly instantiated and configured.'); + $this->assertSame($plugin->getContent(), '
- 1
- 1.1
', 'Derived plugin instance correctly instantiated and configured.'); // Ensure that attempting to instantiate non-existing plugins throws a // PluginException. Test this for a non-existing base plugin, a non-existing diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php index 454165d..ad11bde 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php @@ -16,26 +16,26 @@ public function testInspection() { foreach (['user_login'] as $id) { $plugin = $this->testPluginManager->createInstance($id); $expected_definition = $this->testPluginExpectedDefinitions[$id]; - $this->assertIdentical($plugin->getPluginId(), $id); - $this->assertIdentical($this->testPluginManager->getDefinition($id), $expected_definition); - $this->assertIdentical($plugin->getPluginDefinition(), $expected_definition); + $this->assertSame($plugin->getPluginId(), $id); + $this->assertSame($this->testPluginManager->getDefinition($id), $expected_definition); + $this->assertSame($plugin->getPluginDefinition(), $expected_definition); } // Skip the 'menu' derived blocks, because MockMenuBlock does not implement // PluginInspectionInterface. The others do by extending PluginBase. foreach (['user_login', 'layout'] as $id) { $plugin = $this->mockBlockManager->createInstance($id); $expected_definition = $this->mockBlockExpectedDefinitions[$id]; - $this->assertIdentical($plugin->getPluginId(), $id); - $this->assertIdentical($this->castSafeStrings($this->mockBlockManager->getDefinition($id)), $expected_definition); - $this->assertIdentical($this->castSafeStrings($plugin->getPluginDefinition()), $expected_definition); + $this->assertSame($plugin->getPluginId(), $id); + $this->assertSame($this->castSafeStrings($this->mockBlockManager->getDefinition($id)), $expected_definition); + $this->assertSame($this->castSafeStrings($plugin->getPluginDefinition()), $expected_definition); } // Test a plugin manager that provides defaults. foreach (['test_block1', 'test_block2'] as $id) { $plugin = $this->defaultsTestPluginManager->createInstance($id); $expected_definition = $this->defaultsTestPluginExpectedDefinitions[$id]; - $this->assertIdentical($plugin->getPluginId(), $id); - $this->assertIdentical($this->defaultsTestPluginManager->getDefinition($id), $expected_definition); - $this->assertIdentical($this->castSafeStrings($plugin->getPluginDefinition()), $expected_definition); + $this->assertSame($plugin->getPluginId(), $id); + $this->assertSame($this->defaultsTestPluginManager->getDefinition($id), $expected_definition); + $this->assertSame($this->castSafeStrings($plugin->getPluginDefinition()), $expected_definition); } } diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php index 906e74b..8bfd765 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php @@ -45,7 +45,7 @@ protected function assertElements(array $elements, $expected_html, $message) { $out .= ''; $this->verbose($out); - $this->assertIdentical($actual_html, $expected_html, Html::escape($message)); + $this->assertSame($actual_html, $expected_html, Html::escape($message)); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php b/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php index a962fec..a20798e 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php @@ -77,7 +77,7 @@ public function testMultipleSubThemes() { $registry_base_theme->setThemeManager(\Drupal::theme()); $preprocess_functions = $registry_subsub_theme->get()['theme_test_template_test']['preprocess functions']; - $this->assertIdentical([ + $this->assertSame([ 'template_preprocess', 'test_basetheme_preprocess_theme_test_template_test', 'test_subtheme_preprocess_theme_test_template_test', @@ -85,20 +85,20 @@ public function testMultipleSubThemes() { ], $preprocess_functions); $preprocess_functions = $registry_sub_theme->get()['theme_test_template_test']['preprocess functions']; - $this->assertIdentical([ + $this->assertSame([ 'template_preprocess', 'test_basetheme_preprocess_theme_test_template_test', 'test_subtheme_preprocess_theme_test_template_test', ], $preprocess_functions); $preprocess_functions = $registry_base_theme->get()['theme_test_template_test']['preprocess functions']; - $this->assertIdentical([ + $this->assertSame([ 'template_preprocess', 'test_basetheme_preprocess_theme_test_template_test', ], $preprocess_functions); $preprocess_functions = $registry_base_theme->get()['theme_test_function_suggestions']['preprocess functions']; - $this->assertIdentical([ + $this->assertSame([ 'template_preprocess_theme_test_function_suggestions', 'test_basetheme_preprocess_theme_test_function_suggestions', ], $preprocess_functions, "Theme functions don't have template_preprocess but do have template_preprocess_HOOK"); @@ -125,7 +125,7 @@ public function testSuggestionPreprocessFunctions() { $hook .= "$suggestion"; $expected_preprocess_functions[] = "test_theme_preprocess_$hook"; $preprocess_functions = $registry_theme->get()[$hook]['preprocess functions']; - $this->assertIdentical($expected_preprocess_functions, $preprocess_functions, "$hook has correct preprocess functions."); + $this->assertSame($expected_preprocess_functions, $preprocess_functions, "$hook has correct preprocess functions."); } while ($suggestion = array_shift($suggestions)); $expected_preprocess_functions = [ @@ -136,10 +136,10 @@ public function testSuggestionPreprocessFunctions() { ]; $preprocess_functions = $registry_theme->get()['theme_test_preprocess_suggestions__kitten__meerkat']['preprocess functions']; - $this->assertIdentical($expected_preprocess_functions, $preprocess_functions, 'Suggestion implemented as a function correctly inherits preprocess functions.'); + $this->assertSame($expected_preprocess_functions, $preprocess_functions, 'Suggestion implemented as a function correctly inherits preprocess functions.'); $preprocess_functions = $registry_theme->get()['theme_test_preprocess_suggestions__kitten__bearcat']['preprocess functions']; - $this->assertIdentical($expected_preprocess_functions, $preprocess_functions, 'Suggestion implemented as a template correctly inherits preprocess functions.'); + $this->assertSame($expected_preprocess_functions, $preprocess_functions, 'Suggestion implemented as a template correctly inherits preprocess functions.'); $this->assertTrue(isset($registry_theme->get()['theme_test_preprocess_suggestions__kitten__meerkat__tarsier__moose']), 'Preprocess function with an unimplemented lower-level suggestion is added to the registry.'); } diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php index 61f6475..c3ccf2a 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php @@ -49,7 +49,7 @@ public function testEmpty() { $this->assertTrue($this->themeHandler()->rebuildThemeData()['stark'], 'ThemeHandler::rebuildThemeData() yields all available themes.'); // theme_get_setting() should return global default theme settings. - $this->assertIdentical(theme_get_setting('features.favicon'), TRUE); + $this->assertSame(theme_get_setting('features.favicon'), TRUE); } /** @@ -63,7 +63,7 @@ public function testInstall() { $this->themeInstaller()->install([$name]); - $this->assertIdentical($this->extensionConfig()->get("theme.$name"), 0); + $this->assertSame($this->extensionConfig()->get("theme.$name"), 0); $themes = $this->themeHandler()->listInfo(); $this->assertTrue(isset($themes[$name])); @@ -72,7 +72,7 @@ public function testInstall() { $this->assertEqual(array_keys(system_list('theme')), array_keys($themes)); // Verify that test_basetheme.settings is active. - $this->assertIdentical(theme_get_setting('features.favicon', $name), FALSE); + $this->assertSame(theme_get_setting('features.favicon', $name), FALSE); $this->assertEqual(theme_get_setting('base', $name), 'only'); $this->assertEqual(theme_get_setting('override', $name), 'base'); } diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php index a077c25..97226c0 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php @@ -46,7 +46,7 @@ public function testDefaultConfig() { $path = $this->availableThemes[$name]->getPath(); $this->assertTrue(file_exists("$path/" . InstallStorage::CONFIG_INSTALL_DIRECTORY . "/$name.settings.yml")); $this->container->get('theme_handler')->install([$name]); - $this->assertIdentical(theme_get_setting('base', $name), 'only'); + $this->assertSame(theme_get_setting('base', $name), 'only'); } /** diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php index c79f2cf..d562e7f 100644 --- a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php +++ b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php @@ -185,7 +185,7 @@ public function testGetAndSet() { $value = 'PT20S'; $typed_data = $this->createTypedData(['type' => 'duration_iso8601'], $value); $this->assertTrue($typed_data instanceof DurationInterface, 'Typed data object is an instance of DurationInterface.'); - $this->assertIdentical($typed_data->getValue(), $value, 'DurationIso8601 value was fetched.'); + $this->assertSame($typed_data->getValue(), $value, 'DurationIso8601 value was fetched.'); $this->assertEqual($typed_data->validate()->count(), 0); $typed_data->setValue('P40D'); $this->assertEqual($typed_data->getDuration()->d, 40, 'DurationIso8601 value was changed and set by duration string.'); @@ -209,7 +209,7 @@ public function testGetAndSet() { $value = 20; $typed_data = $this->createTypedData(['type' => 'timespan'], $value); $this->assertTrue($typed_data instanceof DurationInterface, 'Typed data object is an instance of DurationInterface.'); - $this->assertIdentical($typed_data->getValue(), $value, 'Time span value was fetched.'); + $this->assertSame($typed_data->getValue(), $value, 'Time span value was fetched.'); $this->assertEqual($typed_data->validate()->count(), 0); $typed_data->setValue(60 * 60 * 4); $this->assertEqual($typed_data->getDuration()->s, 14400, 'Time span was changed'); @@ -260,10 +260,10 @@ public function testGetAndSet() { $value = $this->randomString(); $typed_data = $this->createTypedData(['type' => 'email'], $value); $this->assertTrue($typed_data instanceof StringInterface, 'Typed data object is an instance of StringInterface.'); - $this->assertIdentical($typed_data->getValue(), $value, 'Email value was fetched.'); + $this->assertSame($typed_data->getValue(), $value, 'Email value was fetched.'); $new_value = 'test@example.com'; $typed_data->setValue($new_value); - $this->assertIdentical($typed_data->getValue(), $new_value, 'Email value was changed.'); + $this->assertSame($typed_data->getValue(), $new_value, 'Email value was changed.'); $this->assertTrue(is_string($typed_data->getString()), 'Email value was converted to string'); $this->assertEqual($typed_data->validate()->count(), 0); $typed_data->setValue(NULL); @@ -296,10 +296,10 @@ public function testGetAndSet() { // Any type. $value = ['foo']; $typed_data = $this->createTypedData(['type' => 'any'], $value); - $this->assertIdentical($typed_data->getValue(), $value, 'Any value was fetched.'); + $this->assertSame($typed_data->getValue(), $value, 'Any value was fetched.'); $new_value = 'test@example.com'; $typed_data->setValue($new_value); - $this->assertIdentical($typed_data->getValue(), $new_value, 'Any value was changed.'); + $this->assertSame($typed_data->getValue(), $new_value, 'Any value was changed.'); $this->assertTrue(is_string($typed_data->getString()), 'Any value was converted to string'); $this->assertEqual($typed_data->validate()->count(), 0); $typed_data->setValue(NULL); @@ -353,8 +353,8 @@ public function testTypedDataLists() { // Make sure that resetting the value using NULL results in an empty array. $clone->setValue([]); $typed_data->setValue(NULL); - $this->assertIdentical($typed_data->getValue(), []); - $this->assertIdentical($clone->getValue(), []); + $this->assertSame($typed_data->getValue(), []); + $this->assertSame($clone->getValue(), []); // Test dealing with NULL items. $typed_data[] = NULL; @@ -475,7 +475,7 @@ public function testTypedDataMaps() { $properties = $typed_data->getProperties(); $this->assertEqual(array_keys($properties), array_keys($value)); - $this->assertIdentical($properties['one'], $typed_data->get('one'), 'Properties are identical.'); + $this->assertSame($properties['one'], $typed_data->get('one'), 'Properties are identical.'); // Test setting a not defined property. It shouldn't show up in the // properties, but be kept in the values. @@ -549,7 +549,7 @@ public function testTypedDataValidation() { $message = t('This value should be %limit or more.', ['%limit' => 5]); $this->assertEqual($violations[0]->getMessage(), $message, 'Translated violation message retrieved.'); $this->assertEqual($violations[0]->getPropertyPath(), ''); - $this->assertIdentical($violations[0]->getRoot(), $integer, 'Root object returned.'); + $this->assertSame($violations[0]->getRoot(), $integer, 'Root object returned.'); // Test translating violation messages when pluralization is used. $definition = DataDefinition::create('string') @@ -628,7 +628,7 @@ public function testTypedDataValidation() { $this->assertEqual($violations->count(), 1); $this->assertEqual($violations[0]->getInvalidValue(), 'string'); - $this->assertIdentical($violations[0]->getPropertyPath(), '0.value'); + $this->assertSame($violations[0]->getPropertyPath(), '0.value'); } }
- 1
- 1.1