diff --git a/core/modules/aggregator/tests/src/Kernel/AggregatorTitleTest.php b/core/modules/aggregator/tests/src/Kernel/AggregatorTitleTest.php index 5b81de3..376bce6 100644 --- a/core/modules/aggregator/tests/src/Kernel/AggregatorTitleTest.php +++ b/core/modules/aggregator/tests/src/Kernel/AggregatorTitleTest.php @@ -24,7 +24,7 @@ class AggregatorTitleTest extends KernelTestBase { * * @var array */ - public static $modules = ['file', 'field', 'options', 'aggregator']; + public static $modules = ['file', 'field', 'options', 'aggregator', 'system']; /** * The field name that is tested. @@ -43,6 +43,8 @@ protected function setUp() { $this->installEntitySchema('aggregator_feed'); $this->installEntitySchema('aggregator_item'); + \Drupal::service('router.builder')->rebuild(); + $this->fieldName = 'title'; } @@ -74,7 +76,7 @@ public function testStringFormatter() { $build = $aggregator_feed->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' => FALSE]]); $result = $this->render($build); - $this->assertTrue(strpos($result, 'testing title') === 0); + $this->assertTrue(strpos($result, 'testing title') !== FALSE); $this->assertTrue(strpos($result, $aggregator_feed->getUrl()) === FALSE); // Verify aggregator item title with and without links. @@ -86,7 +88,7 @@ public function testStringFormatter() { $build = $aggregator_item->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' => FALSE]]); $result = $this->render($build); - $this->assertTrue(strpos($result, 'test title') === 0); + $this->assertTrue(strpos($result, 'test title') !== FALSE); $this->assertTrue(strpos($result, $aggregator_item->getLink()) === FALSE); } diff --git a/core/modules/aggregator/src/Tests/FeedValidationTest.php b/core/modules/aggregator/tests/src/Kernel/FeedValidationTest.php similarity index 87% rename from core/modules/aggregator/src/Tests/FeedValidationTest.php rename to core/modules/aggregator/tests/src/Kernel/FeedValidationTest.php index 2c127d0..fd68d1b 100644 --- a/core/modules/aggregator/src/Tests/FeedValidationTest.php +++ b/core/modules/aggregator/tests/src/Kernel/FeedValidationTest.php @@ -2,20 +2,20 @@ /** * @file - * Contains \Drupal\aggregator\Tests\FeedValidationTest. + * Contains \Drupal\Tests\aggregator\Kernel\FeedValidationTest. */ -namespace Drupal\aggregator\Tests; +namespace Drupal\Tests\aggregator\Kernel; use Drupal\aggregator\Entity\Feed; -use Drupal\system\Tests\Entity\EntityUnitTestBase; +use Drupal\KernelTests\Core\Entity\EntityKernelTestBase; /** * Tests feed validation constraints. * * @group aggregator */ -class FeedValidationTest extends EntityUnitTestBase { +class FeedValidationTest extends EntityKernelTestBase { /** * Modules to install. diff --git a/core/modules/aggregator/src/Tests/ItemWithoutFeedTest.php b/core/modules/aggregator/tests/src/Kernel/ItemWithoutFeedTest.php similarity index 88% rename from core/modules/aggregator/src/Tests/ItemWithoutFeedTest.php rename to core/modules/aggregator/tests/src/Kernel/ItemWithoutFeedTest.php index a6586b9..2e5bca4 100644 --- a/core/modules/aggregator/src/Tests/ItemWithoutFeedTest.php +++ b/core/modules/aggregator/tests/src/Kernel/ItemWithoutFeedTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\aggregator\Tests\ItemWithoutFeedTest. + * Contains \Drupal\Tests\aggregator\Unit\ItemWithoutFeedTest. */ -namespace Drupal\aggregator\Tests; +namespace Drupal\Tests\aggregator\Kernel; use Drupal\aggregator\Entity\Item; use Drupal\KernelTests\KernelTestBase; diff --git a/core/modules/block/src/Tests/BlockInterfaceTest.php b/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php similarity index 96% rename from core/modules/block/src/Tests/BlockInterfaceTest.php rename to core/modules/block/tests/src/Kernel/BlockInterfaceTest.php index 5af8ec0..36dedcf 100644 --- a/core/modules/block/src/Tests/BlockInterfaceTest.php +++ b/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php @@ -2,14 +2,14 @@ /** * @file - * Contains \Drupal\block\Tests\BlockInterfaceTest. + * Contains \Drupal\Tests\block\Kernel\BlockInterfaceTest. */ -namespace Drupal\block\Tests; +namespace Drupal\Tests\block\Kernel; use Drupal\Core\Form\FormState; -use Drupal\simpletest\KernelTestBase; use Drupal\block\BlockInterface; +use Drupal\KernelTests\KernelTestBase; /** * Tests that the block plugin can work properly without a supporting entity. @@ -17,6 +17,7 @@ * @group block */ class BlockInterfaceTest extends KernelTestBase { + public static $modules = array('system', 'block', 'block_test', 'user'); /** diff --git a/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php b/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php index 859e32a..3361665 100644 --- a/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php +++ b/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php @@ -26,7 +26,7 @@ class BlockStorageUnitTest extends KernelTestBase { * * @var array */ - public static $modules = array('block', 'block_test'); + public static $modules = array('block', 'block_test', 'system'); /** * The block storage. diff --git a/core/modules/config/src/Tests/ConfigCRUDTest.php b/core/modules/config/tests/src/Kernel/ConfigCRUDTest.php similarity index 98% rename from core/modules/config/src/Tests/ConfigCRUDTest.php rename to core/modules/config/tests/src/Kernel/ConfigCRUDTest.php index 3d61c9e..c763ade 100644 --- a/core/modules/config/src/Tests/ConfigCRUDTest.php +++ b/core/modules/config/tests/src/Kernel/ConfigCRUDTest.php @@ -2,19 +2,19 @@ /** * @file - * Contains \Drupal\config\Tests\ConfigCRUDTest. + * Contains \Drupal\Tests\config\Kernel\ConfigCRUDTest. */ -namespace Drupal\config\Tests; +namespace Drupal\Tests\config\Kernel; use Drupal\Component\Utility\Crypt; use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Config\ConfigNameException; use Drupal\Core\Config\ConfigValueException; use Drupal\Core\Config\InstallStorage; -use Drupal\simpletest\KernelTestBase; use Drupal\Core\Config\DatabaseStorage; use Drupal\Core\Config\UnsupportedDataTypeConfigException; +use Drupal\KernelTests\KernelTestBase; /** * Tests CRUD operations on configuration objects. diff --git a/core/modules/config/src/Tests/ConfigDiffTest.php b/core/modules/config/tests/src/Kernel/ConfigDiffTest.php similarity index 98% rename from core/modules/config/src/Tests/ConfigDiffTest.php rename to core/modules/config/tests/src/Kernel/ConfigDiffTest.php index 1f32b27..32f40f8 100644 --- a/core/modules/config/src/Tests/ConfigDiffTest.php +++ b/core/modules/config/tests/src/Kernel/ConfigDiffTest.php @@ -2,12 +2,12 @@ /** * @file - * Contains \Drupal\config\Tests\ConfigDiffTest. + * Contains \Drupal\Tests\config\Kernel\ConfigDiffTest. */ -namespace Drupal\config\Tests; +namespace Drupal\Tests\config\Kernel; -use Drupal\simpletest\KernelTestBase; +use Drupal\KernelTests\KernelTestBase; /** * Calculating the difference between two sets of configuration. diff --git a/core/modules/config/src/Tests/ConfigEntityStatusTest.php b/core/modules/config/tests/src/Kernel/ConfigEntityStatusTest.php similarity index 87% rename from core/modules/config/src/Tests/ConfigEntityStatusTest.php rename to core/modules/config/tests/src/Kernel/ConfigEntityStatusTest.php index caad767..695c914 100644 --- a/core/modules/config/src/Tests/ConfigEntityStatusTest.php +++ b/core/modules/config/tests/src/Kernel/ConfigEntityStatusTest.php @@ -2,12 +2,12 @@ /** * @file - * Contains \Drupal\config\Tests\ConfigEntityStatusTest. + * Contains \Drupal\Tests\config\Kernel\ConfigEntityStatusTest. */ -namespace Drupal\config\Tests; +namespace Drupal\Tests\config\Kernel; -use Drupal\simpletest\KernelTestBase; +use Drupal\KernelTests\KernelTestBase; /** * Tests configuration entity status functionality. diff --git a/core/modules/config/src/Tests/ConfigEntityStorageTest.php b/core/modules/config/tests/src/Kernel/ConfigEntityStorageTest.php similarity index 91% rename from core/modules/config/src/Tests/ConfigEntityStorageTest.php rename to core/modules/config/tests/src/Kernel/ConfigEntityStorageTest.php index 0eb1ab6..14c3ddb 100644 --- a/core/modules/config/src/Tests/ConfigEntityStorageTest.php +++ b/core/modules/config/tests/src/Kernel/ConfigEntityStorageTest.php @@ -2,13 +2,13 @@ /** * @file - * Contains \Drupal\config\Tests\ConfigEntityStorageTest. + * Contains \Drupal\Tests\config\Kernel\ConfigEntityStorageTest. */ -namespace Drupal\config\Tests; +namespace Drupal\Tests\config\Kernel; -use Drupal\simpletest\KernelTestBase; use Drupal\Core\Config\ConfigDuplicateUUIDException; +use Drupal\KernelTests\KernelTestBase; /** * Tests sync and importing config entities with IDs and UUIDs that match diff --git a/core/modules/config/src/Tests/ConfigEventsTest.php b/core/modules/config/tests/src/Kernel/ConfigEventsTest.php similarity index 96% rename from core/modules/config/src/Tests/ConfigEventsTest.php rename to core/modules/config/tests/src/Kernel/ConfigEventsTest.php index 431552e..84830b5 100644 --- a/core/modules/config/src/Tests/ConfigEventsTest.php +++ b/core/modules/config/tests/src/Kernel/ConfigEventsTest.php @@ -2,14 +2,14 @@ /** * @file - * Contains \Drupal\config\Tests\ConfigEventsTest. + * Contains \Drupal\Tests\config\Kernel\ConfigEventsTest. */ -namespace Drupal\config\Tests; +namespace Drupal\Tests\config\Kernel; use Drupal\Core\Config\Config; use Drupal\Core\Config\ConfigEvents; -use Drupal\simpletest\KernelTestBase; +use Drupal\KernelTests\KernelTestBase; /** * Tests events fired on configuration objects. diff --git a/core/modules/config/src/Tests/ConfigFileContentTest.php b/core/modules/config/tests/src/Kernel/ConfigFileContentTest.php similarity index 93% rename from core/modules/config/src/Tests/ConfigFileContentTest.php rename to core/modules/config/tests/src/Kernel/ConfigFileContentTest.php index 186458f..b1ac896 100644 --- a/core/modules/config/src/Tests/ConfigFileContentTest.php +++ b/core/modules/config/tests/src/Kernel/ConfigFileContentTest.php @@ -2,13 +2,13 @@ /** * @file - * Contains \Drupal\config\Tests\ConfigFileContentTest. + * Contains \Drupal\Tests\config\Kernel\ConfigFileContentTest. */ -namespace Drupal\config\Tests; +namespace Drupal\Tests\config\Kernel; use Drupal\Core\Config\FileStorage; -use Drupal\simpletest\KernelTestBase; +use Drupal\KernelTests\KernelTestBase; /** * Tests reading and writing of configuration files. @@ -121,16 +121,16 @@ function testReadWriteConfig() { $this->assertNull($config->get('i.dont.exist'), 'Non-existent nested value returned NULL.'); // Read false value. - $this->assertEqual($config->get($false_key), '0', "Boolean FALSE value returned the string '0'."); + $this->assertSame($config->get($false_key), FALSE, "Boolean FALSE value returned the FALSE."); // Read true value. - $this->assertEqual($config->get($true_key), '1', "Boolean TRUE value returned the string '1'."); + $this->assertSame($config->get($true_key), TRUE, "Boolean TRUE value returned the TRUE."); // Read null value. $this->assertIdentical($config->get('null'), NULL); // Read false that had been nested in an array value. - $this->assertEqual($config->get($casting_array_false_value_key), '0', "Nested boolean FALSE value returned the string '0'."); + $this->assertSame($config->get($casting_array_false_value_key), FALSE, "Nested boolean FALSE value returned FALSE."); // Unset a top level value. $config->clear($key); @@ -210,7 +210,7 @@ function testSerialization() { ); // Encode and write, and reload and decode the configuration data. - $filestorage = new FileStorage($this->configDirectories[CONFIG_SYNC_DIRECTORY]); + $filestorage = new FileStorage(config_get_config_directory(CONFIG_SYNC_DIRECTORY)); $filestorage->write($name, $config_data); $config_parsed = $filestorage->read($name); diff --git a/core/modules/config/src/Tests/ConfigModuleOverridesTest.php b/core/modules/config/tests/src/Kernel/ConfigModuleOverridesTest.php similarity index 92% rename from core/modules/config/src/Tests/ConfigModuleOverridesTest.php rename to core/modules/config/tests/src/Kernel/ConfigModuleOverridesTest.php index 169a7ba..d15a529 100644 --- a/core/modules/config/src/Tests/ConfigModuleOverridesTest.php +++ b/core/modules/config/tests/src/Kernel/ConfigModuleOverridesTest.php @@ -2,12 +2,12 @@ /** * @file - * Contains \Drupal\config\Tests\ConfigModuleOverridesTest. + * Contains \Drupal\Tests\config\Kernel\ConfigModuleOverridesTest. */ -namespace Drupal\config\Tests; +namespace Drupal\Tests\config\Kernel; -use Drupal\simpletest\KernelTestBase; +use Drupal\KernelTests\KernelTestBase; /** * Tests module overrides of configuration using event subscribers. diff --git a/core/modules/config/src/Tests/ConfigOverridesPriorityTest.php b/core/modules/config/tests/src/Kernel/ConfigOverridesPriorityTest.php similarity index 96% rename from core/modules/config/src/Tests/ConfigOverridesPriorityTest.php rename to core/modules/config/tests/src/Kernel/ConfigOverridesPriorityTest.php index e42545d..78caf27 100644 --- a/core/modules/config/src/Tests/ConfigOverridesPriorityTest.php +++ b/core/modules/config/tests/src/Kernel/ConfigOverridesPriorityTest.php @@ -2,13 +2,13 @@ /** * @file - * Contains \Drupal\config\Tests\ConfigOverridesPriorityTest. + * Contains \Drupal\Tests\config\Kernel\ConfigOverridesPriorityTest. */ -namespace Drupal\config\Tests; +namespace Drupal\Tests\config\Kernel; use Drupal\Core\Language\Language; -use Drupal\simpletest\KernelTestBase; +use Drupal\KernelTests\KernelTestBase; /** * Tests that language, module and settings.php are applied in the correct diff --git a/core/modules/config/src/Tests/SchemaConfigListenerTest.php b/core/modules/config/tests/src/Kernel/SchemaConfigListenerTest.php similarity index 92% rename from core/modules/config/src/Tests/SchemaConfigListenerTest.php rename to core/modules/config/tests/src/Kernel/SchemaConfigListenerTest.php index 58939b6..61f449a 100644 --- a/core/modules/config/src/Tests/SchemaConfigListenerTest.php +++ b/core/modules/config/tests/src/Kernel/SchemaConfigListenerTest.php @@ -2,13 +2,13 @@ /** * @file - * Contains \Drupal\config\Tests\SchemaConfigListenerTest. + * Contains \Drupal\Tests\config\Kernel\SchemaConfigListenerTest. */ -namespace Drupal\config\Tests; +namespace Drupal\Tests\config\Kernel; use Drupal\Core\Config\Schema\SchemaIncompleteException; -use Drupal\simpletest\KernelTestBase; +use Drupal\KernelTests\KernelTestBase; /** * Tests the functionality of ConfigSchemaChecker in KernelTestBase tests. diff --git a/core/modules/config/src/Tests/Storage/CachedStorageTest.php b/core/modules/config/tests/src/Kernel/Storage/CachedStorageTest.php similarity index 90% rename from core/modules/config/src/Tests/Storage/CachedStorageTest.php rename to core/modules/config/tests/src/Kernel/Storage/CachedStorageTest.php index 402d87a..1e9cf05 100644 --- a/core/modules/config/src/Tests/Storage/CachedStorageTest.php +++ b/core/modules/config/tests/src/Kernel/Storage/CachedStorageTest.php @@ -2,14 +2,16 @@ /** * @file - * Contains \Drupal\config\Tests\Storage\CachedStorageTest. + * Contains \Drupal\Tests\config\Kernel\Storage\CachedStorageTest. */ -namespace Drupal\config\Tests\Storage; +namespace Drupal\Tests\config\Kernel\Storage; use Drupal\Core\Config\FileStorage; use Drupal\Core\Config\CachedStorage; use Drupal\Core\DependencyInjection\ContainerBuilder; +use Drupal\Core\Site\Settings; +use Drupal\Core\StreamWrapper\PublicStream; use Symfony\Component\DependencyInjection\Reference; /** @@ -36,8 +38,7 @@ class CachedStorageTest extends ConfigStorageTestBase { protected function setUp() { parent::setUp(); // Create a directory. - $dir = $this->publicFilesDirectory . '/config'; - mkdir($dir); + $dir = PublicStream::basePath() . '/config'; $this->fileStorage = new FileStorage($dir); $this->storage = new CachedStorage($this->fileStorage, \Drupal::service('cache.config')); $this->cache = \Drupal::service('cache_factory')->get('config'); diff --git a/core/modules/config/src/Tests/Storage/ConfigStorageTestBase.php b/core/modules/config/tests/src/Kernel/Storage/ConfigStorageTestBase.php similarity index 98% rename from core/modules/config/src/Tests/Storage/ConfigStorageTestBase.php rename to core/modules/config/tests/src/Kernel/Storage/ConfigStorageTestBase.php index 412c772..c60dd68 100644 --- a/core/modules/config/src/Tests/Storage/ConfigStorageTestBase.php +++ b/core/modules/config/tests/src/Kernel/Storage/ConfigStorageTestBase.php @@ -2,12 +2,12 @@ /** * @file - * Contains \Drupal\config\Tests\Storage\ConfigStorageTestBase. + * Contains \Drupal\Tests\config\Kernel\Storage\ConfigStorageTestBase. */ -namespace Drupal\config\Tests\Storage; +namespace Drupal\Tests\config\Kernel\Storage; -use Drupal\simpletest\KernelTestBase; +use Drupal\KernelTests\KernelTestBase; /** * Base class for testing storage operations. diff --git a/core/modules/config/src/Tests/Storage/DatabaseStorageTest.php b/core/modules/config/tests/src/Kernel/Storage/DatabaseStorageTest.php similarity index 90% rename from core/modules/config/src/Tests/Storage/DatabaseStorageTest.php rename to core/modules/config/tests/src/Kernel/Storage/DatabaseStorageTest.php index 882b072..3af7496 100644 --- a/core/modules/config/src/Tests/Storage/DatabaseStorageTest.php +++ b/core/modules/config/tests/src/Kernel/Storage/DatabaseStorageTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\config\Tests\Storage\DatabaseStorageTest. + * Contains \Drupal\Tests\config\Kernel\Storage\DatabaseStorageTest. */ -namespace Drupal\config\Tests\Storage; +namespace Drupal\Tests\config\Kernel\Storage; use Drupal\Core\Config\DatabaseStorage; diff --git a/core/modules/config/src/Tests/Storage/FileStorageTest.php b/core/modules/config/tests/src/Kernel/Storage/FileStorageTest.php similarity index 84% rename from core/modules/config/src/Tests/Storage/FileStorageTest.php rename to core/modules/config/tests/src/Kernel/Storage/FileStorageTest.php index a37f084..c98ac84 100644 --- a/core/modules/config/src/Tests/Storage/FileStorageTest.php +++ b/core/modules/config/tests/src/Kernel/Storage/FileStorageTest.php @@ -2,14 +2,15 @@ /** * @file - * Contains \Drupal\config\Tests\Storage\FileStorageTest. + * Contains \Drupal\Tests\config\Kernel\Storage\FileStorageTest. */ -namespace Drupal\config\Tests\Storage; +namespace Drupal\Tests\config\Kernel\Storage; use Drupal\Component\Serialization\Yaml; use Drupal\Core\Config\FileStorage; use Drupal\Core\Config\UnsupportedDataTypeConfigException; +use Drupal\Core\StreamWrapper\PublicStream; /** * Tests FileStorage operations. @@ -31,8 +32,7 @@ class FileStorageTest extends ConfigStorageTestBase { protected function setUp() { parent::setUp(); // Create a directory. - $this->directory = $this->publicFilesDirectory . '/config'; - mkdir($this->directory); + $this->directory = PublicStream::basePath() . '/config'; $this->storage = new FileStorage($this->directory); $this->invalidStorage = new FileStorage($this->directory . '/nonexisting'); @@ -75,12 +75,6 @@ public function testlistAll() { // 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.'); - - // Initialize FileStorage with absolute file path. - $absolute_path = realpath($this->directory); - $storage_absolute_path = new FileStorage($absolute_path); - $config_files = $storage_absolute_path->listAll(); - $this->assertIdentical($config_files, $expected_files, 'Absolute path, two config files found.'); } /** diff --git a/core/modules/content_translation/src/Tests/ContentTranslationConfigImportTest.php b/core/modules/content_translation/tests/src/Kernel/ContentTranslationConfigImportTest.php similarity index 96% rename from core/modules/content_translation/src/Tests/ContentTranslationConfigImportTest.php rename to core/modules/content_translation/tests/src/Kernel/ContentTranslationConfigImportTest.php index 9d3450c..2666d8a 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationConfigImportTest.php +++ b/core/modules/content_translation/tests/src/Kernel/ContentTranslationConfigImportTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\content_translation\Tests\ContentTranslationConfigImportTest. + * Contains \Drupal\Tests\content_translation\Kernel\ContentTranslationConfigImportTest. */ -namespace Drupal\content_translation\Tests; +namespace Drupal\Tests\content_translation\Kernel; use Drupal\Core\Config\ConfigImporter; use Drupal\Core\Config\StorageComparer;