Issue #3192553 by mondrake, longwave: Convert assertIdentical(NULL..) to assertNull(...)

merge-requests/248/head
catch 2021-01-15 09:24:13 +00:00
parent 418c3a2c87
commit b7dd784a24
18 changed files with 35 additions and 35 deletions

View File

@ -509,7 +509,7 @@ class BlockTest extends BlockTestBase {
$theme_installer->uninstall(['seven']);
// Ensure that the block configuration does not exist anymore.
$this->assertIdentical(NULL, Block::load($block->id()));
$this->assertNull(Block::load($block->id()));
}
/**

View File

@ -43,22 +43,22 @@ class ConfigEntityTest extends BrowserTestBase {
// Verify default properties on a newly created empty entity.
$storage = \Drupal::entityTypeManager()->getStorage('config_test');
$empty = $storage->create();
$this->assertIdentical($empty->label, NULL);
$this->assertIdentical($empty->style, NULL);
$this->assertNull($empty->label);
$this->assertNull($empty->style);
$this->assertIdentical($empty->language()->getId(), $default_langcode);
// Verify ConfigEntity properties/methods on the newly created empty entity.
$this->assertTrue($empty->isNew());
$this->assertIdentical($empty->getOriginalId(), NULL);
$this->assertNull($empty->getOriginalId());
$this->assertIdentical($empty->bundle(), 'config_test');
$this->assertIdentical($empty->id(), NULL);
$this->assertNull($empty->id());
$this->assertTrue(Uuid::isValid($empty->uuid()));
$this->assertIdentical($empty->label(), NULL);
$this->assertNull($empty->label());
$this->assertIdentical($empty->get('id'), NULL);
$this->assertNull($empty->get('id'));
$this->assertTrue(Uuid::isValid($empty->get('uuid')));
$this->assertIdentical($empty->get('label'), NULL);
$this->assertIdentical($empty->get('style'), NULL);
$this->assertNull($empty->get('label'));
$this->assertNull($empty->get('style'));
$this->assertIdentical($empty->language()->getId(), $default_langcode);
// Verify Entity properties/methods on the newly created empty entity.

View File

@ -35,7 +35,7 @@ class MigrateSystemSiteTranslationTest extends MigrateDrupal6TestBase {
$this->assertIdentical('/fr-user', $config_translation->get('page.403'));
$this->assertIdentical('/fr-page-not-found', $config_translation->get('page.404'));
$this->assertIdentical('/node', $config_translation->get('page.front'));
$this->assertIdentical(NULL, $config_translation->get('admin_compact_mode'));
$this->assertNull($config_translation->get('admin_compact_mode'));
$config_translation = \Drupal::service('language_manager')->getLanguageConfigOverride('zu', 'system.site');
$this->assertIdentical('zu - site_name', $config_translation->get('name'));
@ -44,7 +44,7 @@ class MigrateSystemSiteTranslationTest extends MigrateDrupal6TestBase {
$this->assertIdentical('/zu-user', $config_translation->get('page.403'));
$this->assertIdentical('/zu-page-not-found', $config_translation->get('page.404'));
$this->assertIdentical('/node', $config_translation->get('page.front'));
$this->assertIdentical(NULL, $config_translation->get('admin_compact_mode'));
$this->assertNull($config_translation->get('admin_compact_mode'));
}
}

View File

@ -61,7 +61,7 @@ class MigrateNodeTypeTest extends MigrateDrupal6TestBase {
// Test we don't have a body field.
$field = FieldConfig::loadByName('node', 'test_story', 'body');
$this->assertIdentical(NULL, $field, 'No body field found');
$this->assertNull($field, 'No body field found');
// Test default menus.
$expected_available_menus = ['navigation'];

View File

@ -42,7 +42,7 @@ class MigrateUserContactSettingsTest extends MigrateDrupal6TestBase {
$uid = 15;
$setting = $user_data->get($module, $uid, $key);
$this->assertIdentical(NULL, $setting);
$this->assertNull($setting);
}
}

View File

@ -132,7 +132,7 @@ class MiniPagerTest extends ViewTestBase {
$view = Views::getView('test_mini_pager');
$this->executeView($view);
$this->assertIdentical($view->get_total_rows, NULL, 'The query was not forced to calculate the total number of results.');
$this->assertNull($view->get_total_rows, 'The query was not forced to calculate the total number of results.');
$this->assertIdentical($view->total_rows, 1, 'The pager calculated the total number of rows.');
// Remove the last node as well and ensure that no "Page 1" is shown.

View File

@ -346,7 +346,7 @@ class CacheTest extends ViewsKernelTestBase {
// Assert each row doesn't contain '_entity' or '_relationship_entities'
// items.
foreach ($cache->data['result'] as $row) {
$this->assertIdentical($row->_entity, NULL, 'Cached row "_entity" property is NULL');
$this->assertNull($row->_entity, 'Cached row "_entity" property is NULL');
$this->assertIdentical($row->_relationship_entities, [], 'Cached row "_relationship_entities" property is empty');
}
}

View File

@ -75,8 +75,8 @@ class SqlQueryTest extends ViewsKernelTestBase {
$this->assertFalse($query->hasTag('test_tag'));
// Check metadata.
$this->assertIdentical($query->getMetaData('key1'), NULL);
$this->assertIdentical($query->getMetaData('key2'), NULL);
$this->assertNull($query->getMetaData('key1'));
$this->assertNull($query->getMetaData('key2'));
}
}

View File

@ -64,8 +64,8 @@ class StyleTableUnitTest extends PluginKernelTestBase {
$style_plugin = $view->style_plugin;
$style_plugin->options['default'] = '';
$style_plugin->buildSortPost();
$this->assertIdentical($style_plugin->order, NULL, 'No sort order was set, when no order was specified and no default column was selected.');
$this->assertIdentical($style_plugin->active, NULL, 'No sort field was set, when no order was specified and no default column was selected.');
$this->assertNull($style_plugin->order, 'No sort order was set, when no order was specified and no default column was selected.');
$this->assertNull($style_plugin->active, 'No sort field was set, when no order was specified and no default column was selected.');
$view->destroy();
// Setup a valid default + column specific default sort order.
@ -97,7 +97,7 @@ class StyleTableUnitTest extends PluginKernelTestBase {
$request->query->set('order', $random_name);
$style_plugin->buildSortPost();
$this->assertIdentical($style_plugin->order, 'asc', 'No sort order was set, when invalid sort order was specified.');
$this->assertIdentical($style_plugin->active, NULL, 'No sort field was set, when invalid sort order was specified.');
$this->assertNull($style_plugin->active, 'No sort field was set, when invalid sort order was specified.');
$view->destroy();
// Use an existing field, and sort both ascending and descending.

View File

@ -325,7 +325,7 @@ class ViewStorageTest extends ViewsKernelTestBase {
// Check the 'name' (ID) is using the View objects default value (NULL) as it
// gets unset.
$this->assertIdentical($copy->id(), NULL, 'The ID has been reset.');
$this->assertNull($copy->id(), 'The ID has been reset.');
// Check the other properties.
// @todo Create a reusable property on the base test class for these?

View File

@ -123,7 +123,7 @@ class ConfigFileContentTest extends KernelTestBase {
$this->assertTrue($config->get($true_key), "Boolean TRUE value returned the TRUE.");
// Read null value.
$this->assertIdentical($config->get('null'), NULL);
$this->assertNull($config->get('null'));
// Read false that had been nested in an array value.
$this->assertFalse($config->get($casting_array_false_value_key), "Nested boolean FALSE value returned FALSE.");

View File

@ -140,7 +140,7 @@ class ConfigImporterTest extends KernelTestBase {
$this->assertFalse($storage->read($dynamic_name));
$config = $this->config($dynamic_name);
$this->assertIdentical($config->get('id'), NULL);
$this->assertNull($config->get('id'));
// Verify that appropriate module API hooks have been invoked.
$this->assertTrue(isset($GLOBALS['hook_config_test']['load']));

View File

@ -69,7 +69,7 @@ class ConfigLanguageOverrideTest extends KernelTestBase {
$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->assertNull($config->getOriginal('language', FALSE));
// Test how overrides react to base configuration changes. Set up some base
// values.

View File

@ -43,7 +43,7 @@ class ConfigModuleOverridesTest extends KernelTestBase {
$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->assertNull($config->getOriginal('module', FALSE));
unset($GLOBALS['config_test_run_module_overrides']);
}

View File

@ -64,7 +64,7 @@ class ConfigOverrideTest extends KernelTestBase {
// 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->assertNull($config->get('baz'));
$this->assertIdentical($config->get('404'), $expected_original_data['404']);
// Set the value for 'baz' (on the original data).
@ -121,7 +121,7 @@ class ConfigOverrideTest extends KernelTestBase {
$this->assertTrue($config->isNew(), 'The configuration object config_test.new is new');
$this->assertIdentical($config->get('key'), 'override');
$config_raw = \Drupal::configFactory()->getEditable('config_test.new');
$this->assertIdentical($config_raw->get('key'), NULL);
$this->assertNull($config_raw->get('key'));
$config_raw
->set('key', 'raw')
->set('new_key', 'new_value')

View File

@ -42,17 +42,17 @@ class KeyValueContentEntityStorageTest extends KernelTestBase {
// 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->assertNull($empty->id->value);
$this->assertNull($empty->name->value);
$this->assertNotEmpty($empty->uuid->value);
$this->assertIdentical($empty->langcode->value, $default_langcode);
// Verify ConfigEntity properties/methods on the newly created empty entity.
$this->assertTrue($empty->isNew());
$this->assertIdentical($empty->bundle(), 'entity_test_label');
$this->assertIdentical($empty->id(), NULL);
$this->assertNull($empty->id());
$this->assertNotEmpty($empty->uuid());
$this->assertIdentical($empty->label(), NULL);
$this->assertNull($empty->label());
// Verify Entity properties/methods on the newly created empty entity.
$this->assertIdentical($empty->getEntityTypeId(), 'entity_test_label');

View File

@ -29,9 +29,9 @@ class DerivativeTest extends PluginTestBase {
// 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->assertNull($this->mockBlockManager->getDefinition('non_existing', FALSE), 'NULL returned as the definition of a non-existing base plugin.');
$this->assertNull($this->mockBlockManager->getDefinition('menu:non_existing', FALSE), 'NULL returned as the definition of a non-existing derivative plugin.');
$this->assertNull($this->mockBlockManager->getDefinition('menu', FALSE), 'NULL returned as the definition of a base plugin that may not be used without deriving.');
}
}

View File

@ -54,7 +54,7 @@ abstract class DiscoveryTestBase extends KernelTestBase {
$this->assertIdentical($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->assertNull($this->emptyDiscovery->getDefinition('non_existing', FALSE), 'NULL returned as the definition of a non-existing plugin.');
}
/**