Commit 0018b94f authored by alexpott's avatar alexpott

Issue #2456477 by Berdir, dawehner, heddn, pguillard: Convert deprecated...

Issue #2456477 by Berdir, dawehner, heddn, pguillard: Convert deprecated \Drupal\simpletest\KernelTestBase tests to KernelTestBaseNG
parent ea8e16ed
<?php
namespace Drupal\editor\Tests;
namespace Drupal\Tests\editor\Kernel;
use Drupal\Component\Serialization\Json;
use Drupal\Core\EventSubscriber\AjaxResponseSubscriber;
......@@ -8,7 +8,7 @@
use Drupal\editor\Entity\Editor;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\quickedit\MetadataGenerator;
use Drupal\quickedit\Tests\QuickEditTestBase;
use Drupal\Tests\quickedit\Kernel\QuickEditTestBase;
use Drupal\quickedit_test\MockEditEntityFieldAccessCheck;
use Drupal\editor\EditorController;
use Symfony\Component\HttpFoundation\Request;
......
<?php
namespace Drupal\forum\Tests;
namespace Drupal\Tests\forum\Kernel;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\node\Entity\Node;
use Drupal\taxonomy\Entity\Term;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
/**
* Tests forum validation constraints.
*
* @group forum
*/
class ForumValidationTest extends EntityUnitTestBase {
class ForumValidationTest extends EntityKernelTestBase {
/**
* Modules to install.
......
<?php
namespace Drupal\language\Tests\Condition;
namespace Drupal\Tests\language\Kernel\Condition;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests that the language condition, provided by the language module, is
......
<?php
namespace Drupal\language\Tests;
namespace Drupal\Tests\language\Kernel;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
/**
......
<?php
namespace Drupal\language\Tests;
namespace Drupal\Tests\language\Kernel;
use Drupal\Core\Language\LanguageInterface;
use Drupal\language\Entity\ContentLanguageSettings;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests default language code is properly generated for entities.
......@@ -18,7 +18,7 @@ class EntityDefaultLanguageTest extends KernelTestBase {
*
* @var array
*/
public static $modules = array('language', 'node', 'field', 'text', 'user');
public static $modules = array('language', 'node', 'field', 'text', 'user', 'system');
/**
* {@inheritdoc}
......
<?php
namespace Drupal\language\Tests;
namespace Drupal\Tests\language\Kernel;
use Drupal\Core\Language\LanguageInterface;
use Drupal\entity_test\Entity\EntityTest;
......@@ -46,7 +46,8 @@ protected function setUp() {
$config = $this->config('language.negotiation');
$config->set('url.prefixes', ['en' => 'en', 'es' => 'es', 'fr' => 'fr'])
->save();
$this->kernel->rebuildContainer();
\Drupal::service('kernel')->rebuildContainer();
$this->createTranslatableEntity();
}
......
<?php
namespace Drupal\language\Tests;
namespace Drupal\Tests\language\Kernel;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Ensures the language config overrides can be installed.
......
<?php
namespace Drupal\language\Tests;
namespace Drupal\Tests\language\Kernel;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\language\Exception\DeleteDefaultLanguageException;
......
<?php
namespace Drupal\language\Tests;
namespace Drupal\Tests\language\Kernel;
use Drupal\Core\Language\LanguageInterface;
use Drupal\language\Entity\ConfigurableLanguage;
......
<?php
namespace Drupal\language\Tests;
namespace Drupal\Tests\language\Kernel;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Test for dependency injected language object.
......
......@@ -1042,7 +1042,7 @@ function locale_string_is_safe($string) {
// inject javascript. When \Drupal\Component\Utility\Xss::filter() removes
// part of tokens, it causes the string to not be translatable when it should
// be translatable.
// @see \Drupal\locale\Tests\LocaleStringIsSafeTest::testLocaleStringIsSafe()
// @see \Drupal\Tests\locale\Kernel\LocaleStringIsSafeTest::testLocaleStringIsSafe()
//
// We can recognize tokens since they are wrapped with brackets and are only
// composed of alphanumeric characters, colon, underscore, and dashes. We can
......
......@@ -7,7 +7,7 @@ locale_test.no_translation:
test:
type: string
label: 'Test'
# See \Drupal\locale\Tests\LocaleConfigSubscriberTest
# See \Drupal\Tests\locale\Kernel\LocaleConfigSubscriberTest
translatable: true
locale_test.translation:
......@@ -17,5 +17,5 @@ locale_test.translation:
test:
type: string
label: 'Test'
# See \Drupal\locale\Tests\LocaleConfigSubscriberTest
# See \Drupal\Tests\locale\Kernel\LocaleConfigSubscriberTest
translatable: true
<?php
namespace Drupal\locale\Tests;
namespace Drupal\Tests\locale\Kernel;
use Drupal\block\Entity\Block;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests that the locale config manager operates correctly.
......
<?php
namespace Drupal\locale\Tests;
namespace Drupal\Tests\locale\Kernel;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Language\Language;
use Drupal\language\Entity\ConfigurableLanguage;
......@@ -15,11 +16,13 @@ class LocaleConfigSubscriberForeignTest extends LocaleConfigSubscriberTest {
/**
* {@inheritdoc}
*/
protected function defaultLanguageData() {
$data = Language::$defaultValues;
$data['id'] = 'hu';
$data['name'] = 'Hungarian';
return $data;
public function register(ContainerBuilder $container) {
parent::register($container);
$language = Language::$defaultValues;
$language['id'] = 'hu';
$language['name'] = 'Hungarian';
$container->setParameter('language.default_values', $language);
}
/**
......
<?php
namespace Drupal\locale\Tests;
namespace Drupal\Tests\locale\Kernel;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\locale\Locale;
use Drupal\locale\StringInterface;
use Drupal\locale\TranslationString;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests that shipped configuration translations are updated correctly.
......@@ -18,7 +18,7 @@ class LocaleConfigSubscriberTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['language', 'locale', 'system'];
public static $modules = ['language', 'locale', 'system', 'locale_test'];
/**
* The configurable language manager used in this test.
......@@ -60,7 +60,6 @@ protected function setUp() {
$this->setupLanguages();
$this->enableModules(['locale_test']);
$this->installConfig(['locale_test']);
// Simulate this hook invoked which would happen if in a non-kernel test
// or normal environment.
......
<?php
namespace Drupal\locale\Tests;
namespace Drupal\Tests\locale\Kernel;
use Drupal\Core\Language\LanguageInterface;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
......
<?php
namespace Drupal\locale\Tests;
namespace Drupal\Tests\locale\Kernel;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests locale translation safe string handling.
......
<?php
namespace Drupal\locale\Tests;
namespace Drupal\Tests\locale\Kernel;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests locale translation project handling.
......@@ -14,7 +14,7 @@ class LocaleTranslationProjectsTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['locale', 'locale_test'];
public static $modules = ['locale', 'locale_test', 'system'];
/**
* The module handler used in this test.
......
<?php
namespace Drupal\menu_link_content\Tests;
namespace Drupal\Tests\menu_link_content\Kernel;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Menu\MenuTreeParameters;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\menu_link_content\Entity\MenuLinkContent;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\user\Entity\User;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\HttpFoundation\Request;
......
<?php
namespace Drupal\menu_link_content\Tests;
namespace Drupal\Tests\menu_link_content\Kernel;
use Drupal\Core\Menu\MenuTreeParameters;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\menu_link_content\Entity\MenuLinkContent;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Symfony\Component\Routing\Route;
/**
......
<?php
namespace Drupal\menu_link_content\Tests;
namespace Drupal\Tests\menu_link_content\Kernel;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Menu\MenuTreeParameters;
use Drupal\menu_link_content\Entity\MenuLinkContent;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Ensures that the menu tree adapts to path alias changes.
......@@ -36,8 +36,8 @@ protected function setUp() {
/**
* {@inheritdoc}
*/
public function containerBuild(ContainerBuilder $container) {
parent::containerBuild($container);
public function register(ContainerBuilder $container) {
parent::register($container);
$definition = $container->getDefinition('path_processor_alias');
$definition
......
<?php
namespace Drupal\node\Tests\Config;
namespace Drupal\Tests\node\Kernel\Config;
use Drupal\node\Entity\NodeType;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Change content types during config create method invocation.
......
<?php
namespace Drupal\node\Tests\Config;
namespace Drupal\Tests\node\Kernel\Config;
use Drupal\field\Entity\FieldConfig;
use Drupal\node\Entity\NodeType;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Create content types during config create method invocation.
......@@ -59,8 +59,8 @@ public function testImportCreate() {
$sync = $this->container->get('config.storage.sync');
$this->copyConfig($active, $sync);
// Manually add new node type.
$src_dir = drupal_get_path('module', 'node_test_config') . '/sync';
$target_dir = $this->configDirectories[CONFIG_SYNC_DIRECTORY];
$src_dir = __DIR__ . '/../../../modules/node_test_config/sync';
$target_dir = config_get_config_directory(CONFIG_SYNC_DIRECTORY);
$this->assertTrue(file_unmanaged_copy("$src_dir/$node_type_config_name.yml", "$target_dir/$node_type_config_name.yml"));
// Import the content of the sync directory.
......
<?php
namespace Drupal\node\Tests;
namespace Drupal\Tests\node\Kernel;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\node\Entity\NodeType;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests node body field storage.
......
<?php
namespace Drupal\node\Tests\Condition;
namespace Drupal\Tests\node\Kernel;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
/**
* Tests that conditions, provided by the node module, are working properly.
*
* @group node
*/
class NodeConditionTest extends EntityUnitTestBase {
class NodeConditionTest extends EntityKernelTestBase {
public static $modules = array('node');
......
<?php
namespace Drupal\node\Tests;
namespace Drupal\Tests\node\Kernel;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
/**
* Tests node field level access.
*
* @group node
*/
class NodeFieldAccessTest extends EntityUnitTestBase {
class NodeFieldAccessTest extends EntityKernelTestBase {
/**
* Modules to enable.
......
<?php
namespace Drupal\node\Tests;
namespace Drupal\Tests\node\Kernel;
use Drupal\Core\Field\Entity\BaseFieldOverride;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
/**
* Tests node field overrides.
*
* @group node
*/
class NodeFieldOverridesTest extends EntityUnitTestBase {
class NodeFieldOverridesTest extends EntityKernelTestBase {
/**
* Current logged in user.
......
<?php
namespace Drupal\node\Tests;
namespace Drupal\Tests\node\Kernel;
use Drupal\Core\Language\LanguageInterface;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the admin listing fallback when views is not enabled.
......
<?php
namespace Drupal\node\Tests;
namespace Drupal\Tests\node\Kernel;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
/**
* Tests node owner functionality.
*
* @group Entity
*/
class NodeOwnerTest extends EntityUnitTestBase {
class NodeOwnerTest extends EntityKernelTestBase {
/**
* Modules to enable.
......
<?php
namespace Drupal\node\Tests;
namespace Drupal\Tests\node\Kernel;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Utility\Html;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\system\Tests\System\TokenReplaceUnitTestBase;
use Drupal\Tests\system\Kernel\Token\TokenReplaceKernelTestBase;
/**
* Generates text using placeholders for dummy content to check node token
......@@ -15,7 +15,7 @@
*
* @group node
*/
class NodeTokenReplaceTest extends TokenReplaceUnitTestBase {
class NodeTokenReplaceTest extends TokenReplaceKernelTestBase {
/**
* Modules to enable.
......
<?php
namespace Drupal\node\Tests;
namespace Drupal\Tests\node\Kernel;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
/**
* Tests node validation constraints.
*
* @group node
*/
class NodeValidationTest extends EntityUnitTestBase {
class NodeValidationTest extends EntityKernelTestBase {
/**
* Modules to enable.
......
<?php
namespace Drupal\quickedit\Tests;
namespace Drupal\Tests\quickedit\Kernel;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\quickedit\EditorSelector;
......
<?php
namespace Drupal\quickedit\Tests;
namespace Drupal\Tests\quickedit\Kernel;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\quickedit\EditorSelector;
......
<?php
namespace Drupal\quickedit\Tests;
namespace Drupal\Tests\quickedit\Kernel;
use Drupal\field\Entity\FieldConfig;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/**
......
<?php
namespace Drupal\rdf\Tests;
namespace Drupal\Tests\rdf\Kernel;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the RDF mapping CRUD functions.
......
<?php
namespace Drupal\rdf\Tests;
namespace Drupal\Tests\rdf\Kernel;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests RDFa attribute generation from RDF mapping.
......
<?php
namespace Drupal\rest\Tests;
namespace Drupal\Tests\rest\Kernel;
use Drupal\Core\Url;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests that REST type and relation link managers work as expected
......
<?php
namespace Drupal\search\Tests;
namespace Drupal\Tests\search\Kernel;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the search_excerpt() function.
......
<?php
namespace Drupal\search\Tests;
namespace Drupal\Tests\search\Kernel;
use Drupal\Core\Language\LanguageInterface;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
// The search index can contain different types of content. Typically the type
// is 'node'. Here we test with _test_ and _test2_ as the type.
......
<?php
namespace Drupal\serialization\Tests;
namespace Drupal\Tests\serialization\Kernel;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
/**
......
......@@ -4,7 +4,7 @@
use Drupal\Core\Asset\Exception\InvalidLibrariesExtendSpecificationException;
use Drupal\Core\Asset\Exception\InvalidLibrariesOverrideSpecificationException;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the library discovery and library discovery parser.
......
......@@ -4,7 +4,7 @@
use Drupal\Core\Entity\EntityMalformedException;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\entity_test\Entity\EntityTestLabel;
/**
......
......@@ -4,7 +4,7 @@
use Drupal\Core\Plugin\Context\Context;
use Drupal\Core\Plugin\Context\ContextDefinition;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\user\Entity\User;
/**
......
<?php
namespace Drupal\system\Tests\System;
namespace Drupal\Tests\system\Kernel\Token;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Utility\Html;
......@@ -13,7 +13,7 @@
*
* @group system
*/
class TokenReplaceUnitTest extends TokenReplaceUnitTestBase {
class TokenReplaceKernelTest extends TokenReplaceKernelTestBase {
/**