Commit daa52e9f authored by alexpott's avatar alexpott

Issue #2684095 by dawehner, amateescu: Convert field kernel tests to KernelTestBaseTNG

parent 6e6b09c6
......@@ -2,22 +2,23 @@
/**
* @file
* Contains \Drupal\comment\Tests\CommentItemTest.
* Contains \Drupal\Tests\comment\Kernel\CommentItemTest.
*/
namespace Drupal\comment\Tests;
namespace Drupal\Tests\comment\Kernel;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Tests the new entity API for the comment field type.
*
* @group comment
*/
class CommentItemTest extends FieldUnitTestBase {
class CommentItemTest extends FieldKernelTestBase {
use CommentTestTrait;
......
......@@ -2,16 +2,16 @@
/**
* @file
* Contains \Drupal\datetime\Tests\DateTimeItemTest.
* Contains \Drupal\Tests\datetime\Kernel\DateTimeItemTest.
*/
namespace Drupal\datetime\Tests;
namespace Drupal\Tests\datetime\Kernel;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/**
......@@ -19,7 +19,7 @@
*
* @group datetime
*/
class DateTimeItemTest extends FieldUnitTestBase {
class DateTimeItemTest extends FieldKernelTestBase {
/**
* Modules to enable.
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\field\Tests\Boolean\BooleanFormatterTest.
* Contains \Drupal\Tests\field\Kernel\Boolean\BooleanFormatterTest.
*/
namespace Drupal\field\Tests\Boolean;
namespace Drupal\Tests\field\Kernel\Boolean;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
......@@ -13,7 +13,7 @@
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the boolean formatter.
......@@ -27,7 +27,7 @@ class BooleanFormatterTest extends KernelTestBase {
*
* @var array
*/
public static $modules = ['field', 'text', 'entity_test', 'user'];
public static $modules = ['field', 'text', 'entity_test', 'user', 'system'];
/**
* @var string
......
......@@ -2,16 +2,16 @@
/**
* @file
* Contains \Drupal\field\Tests\Boolean\BooleanItemTest.
* Contains \Drupal\Tests\field\Kernel\Boolean\BooleanItemTest.
*/
namespace Drupal\field\Tests\Boolean;
namespace Drupal\Tests\field\Kernel\Boolean;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/**
......@@ -19,7 +19,7 @@
*
* @group field
*/
class BooleanItemTest extends FieldUnitTestBase {
class BooleanItemTest extends FieldKernelTestBase {
/**
* {@inheritdoc}
......
......@@ -2,21 +2,22 @@
/**
* @file
* Contains \Drupal\field\Tests\BulkDeleteTest.
* Contains \Drupal\Tests\field\Kernel\BulkDeleteTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Core\Entity\EntityInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Bulk delete storages and fields, and clean up afterwards.
*
* @group field
*/
class BulkDeleteTest extends FieldUnitTestBase {
class BulkDeleteTest extends FieldKernelTestBase {
/**
* The fields to use in this test.
......
......@@ -2,20 +2,21 @@
/**
* @file
* Contains \Drupal\field\Tests\ConfigFieldDefinitionTest.
* Contains \Drupal\Tests\field\Kernel\ConfigFieldDefinitionTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Tests exposing field definitions for configurable fields.
*
* @group field
*/
class ConfigFieldDefinitionTest extends FieldUnitTestBase {
class ConfigFieldDefinitionTest extends FieldKernelTestBase {
/**
* The entity manager service.
......
......@@ -2,22 +2,23 @@
/**
* @file
* Contains \Drupal\field\Tests\DisplayApiTest.
* Contains \Drupal\Tests\field\Kernel\DisplayApiTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Core\Entity\Entity\EntityViewMode;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Tests the field display API.
*
* @group field
*/
class DisplayApiTest extends FieldUnitTestBase {
class DisplayApiTest extends FieldKernelTestBase {
/**
* The field name to use in this test.
......@@ -61,6 +62,11 @@ class DisplayApiTest extends FieldUnitTestBase {
*/
protected $values;
/**
* {@inheritdoc}
*/
public static $modules = ['system'];
protected function setUp() {
parent::setUp();
......
......@@ -2,16 +2,16 @@
/**
* @file
* Contains \Drupal\field\Tests\Email\EmailItemTest.
* Contains \Drupal\Tests\field\Kernel\Email\EmailItemTest.
*/
namespace Drupal\field\Tests\Email;
namespace Drupal\Tests\field\Kernel\Email;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/**
......@@ -19,7 +19,7 @@
*
* @group field
*/
class EmailItemTest extends FieldUnitTestBase {
class EmailItemTest extends FieldKernelTestBase {
protected function setUp() {
parent::setUp();
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\field\Tests\EntityReference\EntityReferenceItemTest.
* Contains \Drupal\Tests\field\Kernel\EntityReference\EntityReferenceItemTest.
*/
namespace Drupal\field\Tests\EntityReference;
namespace Drupal\Tests\field\Kernel\EntityReference;
use Drupal\comment\Entity\Comment;
use Drupal\Component\Render\FormattableMarkup;
......@@ -19,7 +19,8 @@
use Drupal\entity_test\Entity\EntityTestStringId;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\file\Entity\File;
use Drupal\node\Entity\Node;
use Drupal\taxonomy\Entity\Term;
......@@ -32,7 +33,7 @@
*
* @group entity_reference
*/
class EntityReferenceItemTest extends FieldUnitTestBase {
class EntityReferenceItemTest extends FieldKernelTestBase {
use EntityReferenceTestTrait;
......
......@@ -2,13 +2,14 @@
/**
* @file
* Contains \Drupal\field\Tests\FieldAttachOtherTest.
* Contains \Drupal\Tests\field\Kernel\FieldAttachOtherTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Core\Form\FormState;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Tests other Field API functions.
......@@ -16,7 +17,7 @@
* @group field
* @todo move this to the Entity module
*/
class FieldAttachOtherTest extends FieldUnitTestBase {
class FieldAttachOtherTest extends FieldKernelTestBase {
protected function setUp() {
parent::setUp();
......
......@@ -2,13 +2,14 @@
/**
* @file
* Contains \Drupal\field\Tests\FieldAttachStorageTest.
* Contains \Drupal\Tests\field\Kernel\FieldAttachStorageTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Component\Utility\Unicode;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Tests storage-related Field Attach API functions.
......@@ -16,7 +17,7 @@
* @group field
* @todo move this to the Entity module
*/
class FieldAttachStorageTest extends FieldUnitTestBase {
class FieldAttachStorageTest extends FieldKernelTestBase {
protected function setUp() {
parent::setUp();
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\field\Tests\FieldCrudTest.
* Contains \Drupal\Tests\field\Kernel\FieldCrudTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Entity\EntityStorageException;
......@@ -13,13 +13,14 @@
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Create field entities by attaching fields to entities.
*
* @group field
*/
class FieldCrudTest extends FieldUnitTestBase {
class FieldCrudTest extends FieldKernelTestBase {
/**
* The field storage entity.
......
......@@ -2,15 +2,16 @@
/**
* @file
* Contains \Drupal\field\Tests\FieldDataCountTest.
* Contains \Drupal\Tests\field\Kernel\FieldDataCountTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Tests counting field data records and the hasData() method on
......@@ -20,7 +21,7 @@
* @see \Drupal\Core\Entity\FieldableEntityStorageInterface::countFieldData()
* @see \Drupal\field\Entity\FieldStorageConfig::hasData()
*/
class FieldDataCountTest extends FieldUnitTestBase {
class FieldDataCountTest extends FieldKernelTestBase {
/**
* @var \Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface
......
......@@ -2,26 +2,27 @@
/**
* @file
* Contains \Drupal\field\Tests\FieldImportChangeTest.
* Contains \Drupal\Tests\field\Kernel\FieldImportChangeTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\field\Entity\FieldConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Update field storage and fields during config change method invocation.
*
* @group field
*/
class FieldImportChangeTest extends FieldUnitTestBase {
class FieldImportChangeTest extends FieldKernelTestBase {
/**
* Modules to enable.
*
* The default configuration provided by field_test_config is imported by
* \Drupal\field\Tests\FieldUnitTestBase::setUp() when it installs field
* configuration.
* \Drupal\Tests\field\Kernel\FieldKernelTestBase::setUp() when it installs
* field configuration.
*
* @var array
*/
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\field\Tests\FieldImportCreateTest.
* Contains \Drupal\Tests\field\Kernel\FieldImportCreateTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\field\Entity\FieldConfig;
......@@ -16,7 +16,7 @@
*
* @group field
*/
class FieldImportCreateTest extends FieldUnitTestBase {
class FieldImportCreateTest extends FieldKernelTestBase {
/**
* Tests creating field storages and fields during default config import.
......@@ -97,8 +97,8 @@ function testImportCreate() {
$this->copyConfig($active, $sync);
// Add the new files to the sync directory.
$src_dir = drupal_get_path('module', 'field_test_config') . '/sync';
$target_dir = $this->configDirectories[CONFIG_SYNC_DIRECTORY];
$src_dir = __DIR__ . '/../../modules/field_test_config/sync';
$target_dir = config_get_config_directory(CONFIG_SYNC_DIRECTORY);
$this->assertTrue(file_unmanaged_copy("$src_dir/$field_storage_config_name.yml", "$target_dir/$field_storage_config_name.yml"));
$this->assertTrue(file_unmanaged_copy("$src_dir/$field_config_name.yml", "$target_dir/$field_config_name.yml"));
$this->assertTrue(file_unmanaged_copy("$src_dir/$field_storage_config_name_2.yml", "$target_dir/$field_storage_config_name_2.yml"));
......
......@@ -2,28 +2,29 @@
/**
* @file
* Contains \Drupal\field\Tests\FieldImportDeleteTest.
* Contains \Drupal\Tests\field\Kernel\FieldImportDeleteTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Delete field storages and fields during config delete method invocation.
*
* @group field
*/
class FieldImportDeleteTest extends FieldUnitTestBase {
class FieldImportDeleteTest extends FieldKernelTestBase {
/**
* Modules to enable.
*
* The default configuration provided by field_test_config is imported by
* \Drupal\field\Tests\FieldUnitTestBase::setUp() when it installs field
* configuration.
* \Drupal\Tests\field\Kernel\FieldKernelTestBase::setUp() when it installs
* field configuration.
*
* @var array
*/
......
......@@ -2,14 +2,15 @@
/**
* @file
* Contains \Drupal\field\Tests\FieldImportDeleteUninstallTest.
* Contains \Drupal\Tests\field\Kernel\FieldImportDeleteUninstallTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Delete field storages and fields during config synchronization and uninstall
......@@ -19,7 +20,7 @@
* @see \Drupal\field\ConfigImporterFieldPurger
* @see field_config_import_steps_alter()
*/
class FieldImportDeleteUninstallTest extends FieldUnitTestBase {
class FieldImportDeleteUninstallTest extends FieldKernelTestBase {
/**
* Modules to enable.
......
......@@ -2,22 +2,22 @@
/**
* @file
* Contains \Drupal\field\Tests\FieldUnitTestBase.
* Contains \Drupal\Tests\field\Kernel\FieldKernelTestBase.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\simpletest\KernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\KernelTests\KernelTestBase;
/**
* Parent class for Field API unit tests.
*/
abstract class FieldUnitTestBase extends KernelTestBase {
abstract class FieldKernelTestBase extends KernelTestBase {
/**
* Modules to enable.
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\field\Tests\FieldStorageCrudTest.
* Contains \Drupal\Tests\field\Kernel\FieldStorageCrudTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException;
......@@ -13,13 +13,14 @@
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Tests field storage create, read, update, and delete.
*
* @group field
*/
class FieldStorageCrudTest extends FieldUnitTestBase {
class FieldStorageCrudTest extends FieldKernelTestBase {
/**
* Modules to enable.
......
......@@ -2,21 +2,22 @@
/**
* @file
* Contains \Drupal\field\Tests\FieldTypePluginManagerTest.
* Contains \Drupal\Tests\field\Kernel\FieldTypePluginManagerTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Tests the field type manager.
*
* @group field
*/
class FieldTypePluginManagerTest extends FieldUnitTestBase {
class FieldTypePluginManagerTest extends FieldKernelTestBase {
/**
* Tests the default settings convenience methods.
......
......@@ -2,17 +2,17 @@
/**
* @file
* Contains \Drupal\field\Tests\FieldValidationTest.
* Contains \Drupal\Tests\field\Kernel\FieldValidationTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
/**
* Tests field validation.
*
* @group field
*/
class FieldValidationTest extends FieldUnitTestBase {
class FieldValidationTest extends FieldKernelTestBase {
/**
* @var string
......
......@@ -2,10 +2,11 @@
/**
* @file
* Contains \Drupal\field\Tests\FormatterPluginManagerTest.
* Contains \Drupal\Tests\field\Kernel\FormatterPluginManagerTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Field\FormatterPluginManager;
......@@ -14,7 +15,7 @@
*
* @group field
*/
class FormatterPluginManagerTest extends FieldUnitTestBase {
class FormatterPluginManagerTest extends FieldKernelTestBase {
/**
* Tests that getInstance falls back on default if current is not applicable.
......
......@@ -2,16 +2,16 @@
/**
* @file
* Contains \Drupal\field\Tests\Number\NumberItemTest.
* Contains \Drupal\Tests\field\Kernel\Number\NumberItemTest.
*/
namespace Drupal\field\Tests\Number;
namespace Drupal\Tests\field\Kernel\Number;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/**
......@@ -19,7 +19,7 @@
*
* @group field
*/
class NumberItemTest extends FieldUnitTestBase {
class NumberItemTest extends FieldKernelTestBase {
/**
* Modules to enable.
......
......@@ -2,23 +2,24 @@
/**
* @file
* Contains \Drupal\field\Tests\ShapeItemTest.
* Contains \Drupal\Tests\field\Kernel\ShapeItemTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Tests the new entity API for the shape field type.
*
* @group field
*/
class ShapeItemTest extends FieldUnitTestBase {
class ShapeItemTest extends FieldKernelTestBase {
/**
* Modules to enable.
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\field\Tests\String\RawStringFormatterTest.
* Contains \Drupal\Tests\field\Kernel\String\RawStringFormatterTest.
*/
namespace Drupal\field\Tests\String;
namespace Drupal\Tests\field\Kernel\String;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Unicode;
......@@ -14,7 +14,7 @@
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\simpletest\KernelTestBase;