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

8.2.x
Alex Pott 2016-03-10 15:54:24 +00:00
parent 6e6b09c69d
commit daa52e9f1a
57 changed files with 308 additions and 240 deletions

View File

@ -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;

View File

@ -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 @@ use Drupal\field\Entity\FieldStorageConfig;
*
* @group datetime
*/
class DateTimeItemTest extends FieldUnitTestBase {
class DateTimeItemTest extends FieldKernelTestBase {
/**
* Modules to enable.

View File

@ -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\Core\Entity\FieldableEntityInterface;
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

View File

@ -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 @@ use Drupal\field\Entity\FieldStorageConfig;
*
* @group field
*/
class BooleanItemTest extends FieldUnitTestBase {
class BooleanItemTest extends FieldKernelTestBase {
/**
* {@inheritdoc}

View File

@ -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.

View File

@ -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.

View File

@ -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();

View File

@ -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 @@ use Drupal\field\Entity\FieldStorageConfig;
*
* @group field
*/
class EmailItemTest extends FieldUnitTestBase {
class EmailItemTest extends FieldKernelTestBase {
protected function setUp() {
parent::setUp();

View File

@ -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\EntityTest;
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 @@ use Drupal\user\Entity\User;
*
* @group entity_reference
*/
class EntityReferenceItemTest extends FieldUnitTestBase {
class EntityReferenceItemTest extends FieldKernelTestBase {
use EntityReferenceTestTrait;

View File

@ -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 @@ use Drupal\entity_test\Entity\EntityTest;
* @group field
* @todo move this to the Entity module
*/
class FieldAttachOtherTest extends FieldUnitTestBase {
class FieldAttachOtherTest extends FieldKernelTestBase {
protected function setUp() {
parent::setUp();

View File

@ -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 @@ use Drupal\field\Entity\FieldStorageConfig;
* @group field
* @todo move this to the Entity module
*/
class FieldAttachStorageTest extends FieldUnitTestBase {
class FieldAttachStorageTest extends FieldKernelTestBase {
protected function setUp() {
parent::setUp();

View File

@ -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\Core\Field\FieldException;
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.

View File

@ -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 @@ use Drupal\field\Entity\FieldStorageConfig;
* @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

View File

@ -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
*/

View File

@ -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 @@ use Drupal\field\Entity\FieldStorageConfig;
*
* @group field
*/
class FieldImportCreateTest extends FieldUnitTestBase {
class FieldImportCreateTest extends FieldKernelTestBase {
/**
* Tests creating field storages and fields during default config import.
@ -97,8 +97,8 @@ class FieldImportCreateTest extends FieldUnitTestBase {
$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"));

View File

@ -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
*/

View File

@ -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 @@ use Drupal\field\Entity\FieldStorageConfig;
* @see \Drupal\field\ConfigImporterFieldPurger
* @see field_config_import_steps_alter()
*/
class FieldImportDeleteUninstallTest extends FieldUnitTestBase {
class FieldImportDeleteUninstallTest extends FieldKernelTestBase {
/**
* Modules to enable.

View File

@ -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.

View File

@ -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\Core\Field\FieldException;
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.

View File

@ -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.

View File

@ -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

View File

@ -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 @@ use Drupal\Core\Field\FormatterPluginManager;
*
* @group field
*/
class FormatterPluginManagerTest extends FieldUnitTestBase {
class FormatterPluginManagerTest extends FieldKernelTestBase {
/**
* Tests that getInstance falls back on default if current is not applicable.

View File

@ -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 @@ use Drupal\field\Entity\FieldStorageConfig;
*
* @group field
*/
class NumberItemTest extends FieldUnitTestBase {
class NumberItemTest extends FieldKernelTestBase {
/**
* Modules to enable.

View File

@ -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.

View File

@ -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\Core\Entity\FieldableEntityInterface;
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 raw string formatter

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\field\Tests\String\StringFormatterTest.
* Contains \Drupal\Tests\field\Kernel\String\StringFormatterTest.
*/
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\Core\Entity\FieldableEntityInterface;
use Drupal\entity_test\Entity\EntityTestRev;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the creation of text fields.

View File

@ -2,13 +2,13 @@
/**
* @file
* Contains \Drupal\field\Tests\String\UuidFormatterTest.
* Contains \Drupal\Tests\field\Kernel\String\UuidFormatterTest.
*/
namespace Drupal\field\Tests\String;
namespace Drupal\Tests\field\Kernel\String;
use Drupal\simpletest\KernelTestBase;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the output of a UUID field.

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\field\Tests\TestItemTest.
* Contains \Drupal\Tests\field\Kernel\TestItemTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Field\FieldItemInterface;
@ -13,13 +13,14 @@ 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 test field type.
*
* @group field
*/
class TestItemTest extends FieldUnitTestBase {
class TestItemTest extends FieldKernelTestBase {
/**
* Modules to enable.

View File

@ -2,20 +2,21 @@
/**
* @file
* Contains \Drupal\field\Tests\TestItemWithDependenciesTest.
* Contains \Drupal\Tests\field\Kernel\TestItemWithDependenciesTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Tests the new entity API for the test field with dependencies type.
*
* @group field
*/
class TestItemWithDependenciesTest extends FieldUnitTestBase {
class TestItemWithDependenciesTest extends FieldKernelTestBase {
/**
* Modules to enable.

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\field\Tests\Timestamp\TimestampFormatterTest.
* Contains \Drupal\Tests\field\Kernel\Timestamp\TimestampFormatterTest.
*/
namespace Drupal\field\Tests\Timestamp;
namespace Drupal\Tests\field\Kernel\Timestamp;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Unicode;
@ -14,7 +14,7 @@ use Drupal\Core\Entity\FieldableEntityInterface;
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 timestamp formatters.
@ -104,7 +104,7 @@ class TimestampFormatterTest extends KernelTestBase {
/**
* Tests TimestampFormatter.
*/
protected function testTimestampFormatter() {
public function testTimestampFormatter() {
$data = [];
// Test standard formats.
@ -142,7 +142,7 @@ class TimestampFormatterTest extends KernelTestBase {
/**
* Tests TimestampAgoFormatter.
*/
protected function testTimestampAgoFormatter() {
public function testTimestampAgoFormatter() {
$data = [];
foreach (array(1, 2, 3, 4, 5, 6) as $granularity) {

View File

@ -2,13 +2,14 @@
/**
* @file
* Contains \Drupal\field\Tests\TranslationTest.
* Contains \Drupal\Tests\field\Kernel\TranslationTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Component\Utility\Unicode;
use Drupal\field\Entity\FieldConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\field\Entity\FieldStorageConfig;
@ -19,7 +20,7 @@ use Drupal\field\Entity\FieldStorageConfig;
*
* @group field
*/
class TranslationTest extends FieldUnitTestBase {
class TranslationTest extends FieldKernelTestBase {
/**
* Modules to enable.
@ -193,7 +194,7 @@ class TranslationTest extends FieldUnitTestBase {
}
foreach ($entity->getTranslationLanguages() as $langcode => $language) {
$this->assertEqual($entity->getTranslation($langcode)->{$field_name_default}->getValue(), $empty_items, format_string('Empty value correctly populated for language %language.', array('%language' => $langcode)));
$this->assertEquals([], $entity->getTranslation($langcode)->{$field_name_default}->getValue(), format_string('Empty value correctly populated for language %language.', array('%language' => $langcode)));
}
}
}

View File

@ -2,16 +2,16 @@
/**
* @file
* Contains \Drupal\field\Tests\Uri\UriItemTest.
* Contains \Drupal\Tests\field\Kernel\Uri\UriItemTest.
*/
namespace Drupal\field\Tests\Uri;
namespace Drupal\Tests\field\Kernel\Uri;
use Drupal\Component\Utility\Unicode;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Tests URI field functionality.
@ -20,7 +20,7 @@ use Drupal\field\Tests\FieldUnitTestBase;
*
* @group field
*/
class UriItemTest extends FieldUnitTestBase {
class UriItemTest extends FieldKernelTestBase {
/**
* A field to use in this test class.

View File

@ -2,19 +2,20 @@
/**
* @file
* Contains \Drupal\field\Tests\WidgetPluginManagerTest.
* Contains \Drupal\Tests\field\Kernel\WidgetPluginManagerTest.
*/
namespace Drupal\field\Tests;
namespace Drupal\Tests\field\Kernel;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Field\WidgetPluginManager;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
/**
* Tests the field widget manager.
*
* @group field
*/
class WidgetPluginManagerTest extends FieldUnitTestBase {
class WidgetPluginManagerTest extends FieldKernelTestBase {
/**
* Tests that the widget definitions alter hook works.

View File

@ -2,17 +2,17 @@
/**
* @file
* Contains \Drupal\file\Tests\FileItemTest.
* Contains \Drupal\Tests\file\Kernel\FileItemTest.
*/
namespace Drupal\file\Tests;
namespace Drupal\Tests\file\Kernel;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
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;
use Drupal\file\Entity\File;
@ -21,7 +21,7 @@ use Drupal\file\Entity\File;
*
* @group file
*/
class FileItemTest extends FieldUnitTestBase {
class FileItemTest extends FieldKernelTestBase {
/**
* Modules to enable.

View File

@ -2,17 +2,17 @@
/**
* @file
* Contains \Drupal\image\Tests\ImageItemTest.
* Contains \Drupal\Tests\image\Kernel\ImageItemTest.
*/
namespace Drupal\image\Tests;
namespace Drupal\Tests\image\Kernel;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
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;
use Drupal\file\Entity\File;
@ -21,7 +21,7 @@ use Drupal\file\Entity\File;
*
* @group image
*/
class ImageItemTest extends FieldUnitTestBase {
class ImageItemTest extends FieldKernelTestBase {
/**
* Modules to enable.

View File

@ -207,7 +207,7 @@ class LinkFormatter extends FormatterBase implements ContainerFactoryPluginInter
// field template wrapper, and set the URL value in a content
// attribute.
// @todo Does RDF need a URL rather than an internal URI here?
// @see \Drupal\rdf\Tests\Field\LinkFieldRdfaTest.
// @see \Drupal\Tests\rdf\Kernel\Field\LinkFieldRdfaTest.
$content = str_replace('internal:/', '', $item->uri);
$item->_attributes += array('content' => $content);
}

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\link\Tests\LinkItemTest.
* Contains \Drupal\Tests\link\Kernel\LinkItemTest.
*/
namespace Drupal\link\Tests;
namespace Drupal\Tests\link\Kernel;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Field\FieldItemListInterface;
@ -13,7 +13,7 @@ use Drupal\Core\Field\FieldItemInterface;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\link\LinkItemInterface;
/**
@ -21,7 +21,7 @@ use Drupal\link\LinkItemInterface;
*
* @group link
*/
class LinkItemTest extends FieldUnitTestBase {
class LinkItemTest extends FieldKernelTestBase {
/**
* Modules to enable.

View File

@ -2,15 +2,16 @@
/**
* @file
* Contains \Drupal\options\Tests\OptionsFieldTest.
* Contains \Drupal\Tests\options\Kernel\OptionsFieldTest.
*/
namespace Drupal\options\Tests;
namespace Drupal\Tests\options\Kernel;
use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\options\Kernel\OptionsFieldUnitTestBase;
/**
* Tests for the 'Options' field types.

View File

@ -2,19 +2,19 @@
/**
* @file
* Contains \Drupal\options\Tests\OptionsFieldUnitTestBase.
* Contains \Drupal\Tests\options\Kernel\OptionsFieldUnitTestBase.
*/
namespace Drupal\options\Tests;
namespace Drupal\Tests\options\Kernel;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/**
* Base class for Options module integration tests.
*/
abstract class OptionsFieldUnitTestBase extends FieldUnitTestBase {
abstract class OptionsFieldUnitTestBase extends FieldKernelTestBase {
/**
* Modules to enable.

View File

@ -2,12 +2,13 @@
/**
* @file
* Contains \Drupal\options\Tests\OptionsFormattersTest.
* Contains \Drupal\Tests\options\Kernel\OptionsFormattersTest.
*/
namespace Drupal\options\Tests;
namespace Drupal\Tests\options\Kernel;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\options\Kernel\OptionsFieldUnitTestBase;
/**
* Tests the Options field type formatters.

View File

@ -1,12 +1,13 @@
<?php
/**
* @file
* Contains \Drupal\rdf\Tests\Field\DateTimeFieldRdfaTest.
* Contains \Drupal\Tests\rdf\Kernel\Field\DateTimeFieldRdfaTest.
*/
namespace Drupal\rdf\Tests\Field;
namespace Drupal\Tests\rdf\Kernel\Field;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase;
/**
* Tests RDFa output by datetime field formatters.

View File

@ -1,12 +1,13 @@
<?php
/**
* @file
* Contains \Drupal\rdf\Tests\Field\EmailFieldRdfaTest.
* Contains \Drupal\Tests\rdf\Kernel\Field\EmailFieldRdfaTest.
*/
namespace Drupal\rdf\Tests\Field;
namespace Drupal\Tests\rdf\Kernel\Field;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase;
/**
* Tests RDFa output by email field formatters.

View File

@ -1,12 +1,13 @@
<?php
/**
* @file
* Contains \Drupal\rdf\Tests\Field\EntityReferenceRdfaTest.
* Contains \Drupal\Tests\rdf\Kernel\Field\EntityReferenceRdfaTest.
*/
namespace Drupal\rdf\Tests\Field;
namespace Drupal\Tests\rdf\Kernel\Field;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;

View File

@ -1,12 +1,13 @@
<?php
/**
* @file
* Contains \Drupal\rdf\Tests\Field\FieldRdfaDatatypeCallbackTest.
* Contains \Drupal\Tests\rdf\Kernel\Field\FieldRdfaDatatypeCallbackTest.
*/
namespace Drupal\rdf\Tests\Field;
namespace Drupal\Tests\rdf\Kernel\Field;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase;
/**
* Tests the RDFa output of a text field formatter with a datatype callback.

View File

@ -1,16 +1,16 @@
<?php
/**
* @file
* Contains \Drupal\rdf\Tests\Field\FieldRdfaTestBase.
* Contains \Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase.
*/
namespace Drupal\rdf\Tests\Field;
namespace Drupal\Tests\rdf\Kernel\Field;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
abstract class FieldRdfaTestBase extends FieldUnitTestBase {
abstract class FieldRdfaTestBase extends FieldKernelTestBase {
/**
* The machine name of the field type to test.
@ -45,7 +45,7 @@ abstract class FieldRdfaTestBase extends FieldUnitTestBase {
*
* @var bool
*/
protected $debug = TRUE;
protected $debug = FALSE;
/**
* Modules to enable.
@ -102,8 +102,8 @@ abstract class FieldRdfaTestBase extends FieldUnitTestBase {
// If verbose debugging is turned on, display the HTML and parsed RDF
// in the results.
if ($this->debug) {
debug($output);
debug($graph->toRdfPhp());
print_r($output);
print_r($graph->toRdfPhp());
}
$this->assertTrue($graph->hasProperty($this->uri, $property, $expected_rdf_value), "Formatter {$formatter['type']} exposes data correctly for {$this->fieldType} fields.");

View File

@ -1,12 +1,13 @@
<?php
/**
* @file
* Contains \Drupal\rdf\Tests\Field\LinkFieldRdfaTest.
* Contains \Drupal\Tests\rdf\Kernel\Field\LinkFieldRdfaTest.
*/
namespace Drupal\rdf\Tests\Field;
namespace Drupal\Tests\rdf\Kernel\Field;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase;
/**
* Tests the placement of RDFa in link field formatters.

View File

@ -1,12 +1,13 @@
<?php
/**
* @file
* Contains \Drupal\rdf\Tests\Field\NumberFieldRdfaTest.
* Contains \Drupal\Tests\rdf\Kernel\Field\NumberFieldRdfaTest.
*/
namespace Drupal\rdf\Tests\Field;
namespace Drupal\Tests\rdf\Kernel\Field;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase;
/**
* Tests RDFa output by number field formatters.

View File

@ -1,12 +1,13 @@
<?php
/**
* @file
* Contains \Drupal\rdf\Tests\Field\StringFieldRdfaTest.
* Contains \Drupal\Tests\rdf\Kernel\Field\StringFieldRdfaTest.
*/
namespace Drupal\rdf\Tests\Field;
namespace Drupal\Tests\rdf\Kernel\Field;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase;
/**
* Tests RDFa output by text field formatters.

View File

@ -1,12 +1,13 @@
<?php
/**
* @file
* Contains \Drupal\rdf\Tests\Field\TelephoneFieldRdfaTest.
* Contains \Drupal\Tests\rdf\Kernel\Field\TelephoneFieldRdfaTest.
*/
namespace Drupal\rdf\Tests\Field;
namespace Drupal\Tests\rdf\Kernel\Field;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase;
/**
* Tests RDFa output by telephone field formatters.

View File

@ -1,12 +1,13 @@
<?php
/**
* @file
* Contains \Drupal\rdf\Tests\Field\TextFieldRdfaTest.
* Contains \Drupal\Tests\rdf\Kernel\Field\TextFieldRdfaTest.
*/
namespace Drupal\rdf\Tests\Field;
namespace Drupal\Tests\rdf\Kernel\Field;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase;
/**
* Tests RDFa output by text field formatters.

View File

@ -13,6 +13,9 @@ use Symfony\Component\HttpFoundation\Request;
/**
* Rebuilds the router when the provider is instantiated.
*
* @todo Move this outside of simpletest namespace to the Drupal\Tests, see
* https://www.drupal.org/node/2672762
*/
class RouteProvider implements PreloadableRouteProviderInterface, PagedRouteProviderInterface {

View File

@ -33,15 +33,25 @@ class TestServiceProvider implements ServiceProviderInterface, ServiceModifierIn
*/
public function alter(ContainerBuilder $container) {
if (static::$currentTest instanceof KernelTestBase) {
// While $container->get() does a recursive resolve, getDefinition() does
// not, so do it ourselves.
foreach (['router.route_provider' => 'RouteProvider'] as $original_id => $class) {
for ($id = $original_id; $container->hasAlias($id); $id = (string) $container->getAlias($id));
$definition = $container->getDefinition($id);
$definition->clearTag('needs_destruction');
$container->setDefinition("simpletest.$original_id", $definition);
$container->setDefinition($id, new Definition('Drupal\simpletest\\' . $class));
}
static::addRouteProvider($container);
}
}
/**
* Add the on demand rebuild route provider service.
*
* @param \Drupal\Core\DependencyInjection\ContainerBuilder $container
*/
public static function addRouteProvider(ContainerBuilder $container) {
foreach (['router.route_provider' => 'RouteProvider'] as $original_id => $class) {
// While $container->get() does a recursive resolve, getDefinition() does
// not, so do it ourselves.
for ($id = $original_id; $container->hasAlias($id); $id = (string) $container->getAlias($id));
$definition = $container->getDefinition($id);
$definition->clearTag('needs_destruction');
$container->setDefinition("simpletest.$original_id", $definition);
$container->setDefinition($id, new Definition('Drupal\simpletest\\' . $class));
}
}
}

View File

@ -5,7 +5,7 @@
* Contains \Drupal\Tests\simpletest\Unit\TestInfoParsingTest.
*/
namespace Drupal\Tests\simpletest\Unit;
namespace Drupal\Tests\simpletest\Unit {
use Composer\Autoload\ClassLoader;
use Drupal\Core\Extension\Extension;
@ -87,18 +87,18 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'group' => 'field',
'description' => 'Bulk delete storages and fields, and clean up afterwards.',
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'group' => 'simpletest',
'description' => 'Tests the Simpletest UI internal browser.',
'type' => 'Simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards.
* Tests the Simpletest UI internal browser.
*
* @group field
* @group simpletest
*/
",
];
@ -107,18 +107,19 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'group' => 'field',
'description' => 'Bulk delete storages and fields, and clean up afterwards.',
'type' => 'Simpletest'
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'group' => 'simpletest',
'description' => 'Tests the Simpletest UI internal browser.',
'type' => 'Simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards.
* Tests the Simpletest UI internal browser.
*
* @group field
* @group simpletest
*/
*/
",
];
@ -128,18 +129,18 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'group' => 'field',
'description' => 'Bulk delete storages and fields, and clean up afterwards. * @',
'type' => 'Simpletest'
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'group' => 'simpletest',
'description' => 'Tests the Simpletest UI internal browser. * @',
'type' => 'Simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards. * @
* Tests the Simpletest UI internal browser. * @
*
* @group field
* @group simpletest
*/
",
];
@ -148,19 +149,19 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'group' => 'Test',
'description' => 'Bulk delete storages and fields, and clean up afterwards.',
'type' => 'Simpletest'
'description' => 'Tests the Simpletest UI internal browser.',
'type' => 'Simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards.
* Tests the Simpletest UI internal browser.
*
* @group Test
* @group field
* @group simpletest
*/
",
];
@ -169,20 +170,20 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'group' => 'field',
'description' => 'Bulk delete storages and fields, and clean up afterwards.',
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'description' => 'Tests the Simpletest UI internal browser.',
'type' => 'Simpletest',
'requires' => ['module' => ['test']],
'type' => 'Simpletest'
'group' => 'simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards.
* Tests the Simpletest UI internal browser.
*
* @dependencies test
* @group field
* @group simpletest
*/
",
];
@ -191,20 +192,20 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'group' => 'field',
'description' => 'Bulk delete storages and fields, and clean up afterwards.',
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'description' => 'Tests the Simpletest UI internal browser.',
'type' => 'Simpletest',
'requires' => ['module' => ['test', 'test1', 'test2']],
'type' => 'Simpletest'
'group' => 'simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards.
* Tests the Simpletest UI internal browser.
*
* @dependencies test, test1,test2
* @group field
* @dependencies test, test1, test2
* @group simpletest
*/
",
];
@ -213,18 +214,19 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'group' => 'field',
'description' => 'Bulk delete storages and fields, and clean up afterwards. And the summary line continues and there is no gap to the annotation.',
'type' => 'Simpletest'
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'description' => 'Tests the Simpletest UI internal browser. And the summary line continues an there is no gap to the annotation.',
'type' => 'Simpletest',
'group' => 'simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards. And the summary
* line continues and there is no gap to the annotation.
* @group field
* Tests the Simpletest UI internal browser. And the summary line continues an
* there is no gap to the annotation.
*
* @group simpletest
*/
",
];
@ -234,10 +236,10 @@ class TestInfoParsingTest extends UnitTestCase {
/**
* @covers ::getTestInfo
* @expectedException \Drupal\simpletest\Exception\MissingGroupException
* @expectedExceptionMessage Missing @group annotation in Drupal\field\Tests\BulkDeleteTest
* @expectedExceptionMessage Missing @group annotation in Drupal\KernelTests\field\BulkDeleteTest
*/
public function testTestInfoParserMissingGroup() {
$classname = 'Drupal\field\Tests\BulkDeleteTest';
$classname = 'Drupal\KernelTests\field\BulkDeleteTest';
$doc_comment = <<<EOT
/**
* Bulk delete storages and fields, and clean up afterwards.
@ -250,7 +252,7 @@ EOT;
* @covers ::getTestInfo
*/
public function testTestInfoParserMissingSummary() {
$classname = 'Drupal\field\Tests\BulkDeleteTest';
$classname = 'Drupal\KernelTests\field\BulkDeleteTest';
$doc_comment = <<<EOT
/**
* @group field
@ -410,3 +412,19 @@ class TestTestDiscovery extends TestDiscovery {
}
}
}
namespace Drupal\simpletest\Tests {
use Drupal\simpletest\WebTestBase;
/**
* Tests the Simpletest UI internal browser.
*
* @group simpletest
*/
class ExampleSimpleTest extends WebTestBase {
}
}

View File

@ -2,16 +2,16 @@
/**
* @file
* Contains \Drupal\telephone\Tests\TelephoneItemTest.
* Contains \Drupal\Tests\telephone\Kernel\TelephoneItemTest.
*/
namespace Drupal\telephone\Tests;
namespace Drupal\Tests\telephone\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 @@ use Drupal\field\Entity\FieldStorageConfig;
*
* @group telephone
*/
class TelephoneItemTest extends FieldUnitTestBase {
class TelephoneItemTest extends FieldKernelTestBase {
/**
* Modules to enable.

View File

@ -2,15 +2,15 @@
/**
* @file
* Contains \Drupal\text\Tests\TextWithSummaryItemTest.
* Contains \Drupal\Tests\text\Kernel\TextWithSummaryItemTest.
*/
namespace Drupal\text\Tests;
namespace Drupal\Tests\text\Kernel;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Tests\FieldUnitTestBase;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\filter\Entity\FilterFormat;
@ -19,7 +19,7 @@ use Drupal\filter\Entity\FilterFormat;
*
* @group text
*/
class TextWithSummaryItemTest extends FieldUnitTestBase {
class TextWithSummaryItemTest extends FieldKernelTestBase {
/**
* Modules to enable.

View File

@ -37,13 +37,6 @@ class RouteProviderTest extends KernelTestBase {
$this->installEntitySchema('entity_test_mul');
$this->installEntitySchema('entity_test_admin_routes');
$router_builder = \Drupal::service('router.builder');
$router_builder->rebuild();
/** @var \Drupal\Core\Routing\RouteBuilderInterface $router_builder */
$router_builder = \Drupal::service('router.builder');
$router_builder->rebuild();
/** @var \Drupal\user\RoleInterface $role */
$role = Role::create([
'id' => RoleInterface::ANONYMOUS_ID

View File

@ -25,6 +25,7 @@ use Drupal\Core\Site\Settings;
use Drupal\simpletest\AssertContentTrait;
use Drupal\simpletest\AssertHelperTrait;
use Drupal\simpletest\RandomGeneratorTrait;
use Drupal\simpletest\TestServiceProvider;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpFoundation\Request;
use org\bovigo\vfs\vfsStream;
@ -601,6 +602,7 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
$container->getDefinition('password')
->setArguments(array(1));
}
TestServiceProvider::addRouteProvider($container);
}
/**
@ -923,6 +925,12 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
* The rendered string output (typically HTML).
*/
protected function render(array &$elements) {
// \Drupal\Core\Render\BareHtmlPageRenderer::renderBarePage calls out to
// system_page_attachments() directly.
if (!\Drupal::moduleHandler()->moduleExists('system')) {
throw new \Exception(__METHOD__ . ' requires system module to be installed.');
}
// Use the bare HTML page renderer to render our links.
$renderer = $this->container->get('bare_html_page_renderer');
$response = $renderer->renderBarePage(