Commit 0db5b138 authored by alexpott's avatar alexpott

Issue #2686207 by Berdir: Convert simpletest kernel tests in modules A-I to phpunit

parent 48e0852c
......@@ -24,7 +24,7 @@
* is invalid.
*
* @see \Drupal\simpletest\WebTestBase::setUp()
* @see \Drupal\simpletest\KernelTestBase::containerBuild()
* @see \Drupal\KernelTests\KernelTestBase::register()
*/
class ConfigSchemaChecker implements EventSubscriberInterface {
use SchemaCheckTrait;
......
......@@ -2,14 +2,14 @@
/**
* @file
* Contains \Drupal\aggregator\Tests\AggregatorTitleTest.
* Contains \Drupal\Tests\aggregator\Kernel\AggregatorTitleTest.
*/
namespace Drupal\aggregator\Tests;
namespace Drupal\Tests\aggregator\Kernel;
use Drupal\aggregator\Entity\Feed;
use Drupal\aggregator\Entity\Item;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
......@@ -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';
}
......@@ -69,25 +71,25 @@ public function testStringFormatter() {
$build = $aggregator_feed->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' => TRUE]]);
$result = $this->render($build);
$this->assertTrue(strpos($result, 'testing title'));
$this->assertTrue(strpos($result, 'href="' . $aggregator_feed->getUrl()) . '"');
$this->assertContains('testing title', $result);
$this->assertContains('href="' . $aggregator_feed->getUrl() . '"', $result);
$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, $aggregator_feed->getUrl()) === FALSE);
$this->assertContains('testing title', $result);
$this->assertNotContains($aggregator_feed->getUrl(), $result);
// Verify aggregator item title with and without links.
$build = $aggregator_item->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' =>TRUE]]);
$result = $this->render($build);
$this->assertTrue(strpos($result, 'test title'));
$this->assertTrue(strpos($result, 'href="' . $aggregator_item->getLink()) . '"');
$this->assertContains('test title', $result);
$this->assertContains('href="' . $aggregator_item->getLink() . '"', $result);
$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, $aggregator_item->getLink()) === FALSE);
$this->assertContains('test title', $result);
$this->assertNotContains($aggregator_item->getLink(), $result);
}
}
......@@ -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.
......
......@@ -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;
......
......@@ -2,14 +2,14 @@
/**
* @file
* Contains \Drupal\block\Tests\BlockConfigSchemaTest.
* Contains \Drupal\Tests\block\Kernel\BlockConfigSchemaTest.
*/
namespace Drupal\block\Tests;
namespace Drupal\Tests\block\Kernel;
use Drupal\block\Entity\Block;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the block config schema.
......
......@@ -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');
/**
......
......@@ -2,13 +2,13 @@
/**
* @file
* Contains \Drupal\block\Tests\BlockStorageUnitTest.
* Contains \Drupal\Tests\block\Kernel\BlockStorageUnitTest.
*/
namespace Drupal\block\Tests;
namespace Drupal\Tests\block\Kernel;
use Drupal\Core\Config\Entity\ConfigEntityStorage;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\block_test\Plugin\Block\TestHtmlBlock;
use Drupal\Component\Plugin\Exception\PluginException;
use Drupal\block\Entity\Block;
......@@ -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.
......
......@@ -2,15 +2,15 @@
/**
* @file
* Contains \Drupal\block\Tests\BlockViewBuilderTest.
* Contains \Drupal\Tests\block\Kernel\BlockViewBuilderTest.
*/
namespace Drupal\block\Tests;
namespace Drupal\Tests\block\Kernel;
use Drupal\Component\Utility\Html;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\LanguageInterface;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\block\Entity\Block;
/**
......
......@@ -2,14 +2,14 @@
/**
* @file
* Contains \Drupal\book\Tests\BookUninstallTest.
* Contains \Drupal\Tests\book\Kernel\BookUninstallTest.
*/
namespace Drupal\book\Tests;
namespace Drupal\Tests\book\Kernel;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests that the Book module cannot be uninstalled if books exist.
......
<?php
/**
* @file
* Contains \Drupal\breakpoint\Tests\BreakpointDiscoveryTest.
* Contains \Drupal\Tests\breakpoint\Kernel\BreakpointDiscoveryTest.
*/
namespace Drupal\breakpoint\Tests;
namespace Drupal\Tests\breakpoint\Kernel;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests discovery of breakpoints provided by themes and modules.
......
......@@ -2,13 +2,13 @@
/**
* @file
* Contains \Drupal\ckeditor\Tests\CKEditorPluginManagerTest.
* Contains \Drupal\Tests\ckeditor\Kernel\CKEditorPluginManagerTest.
*/
namespace Drupal\ckeditor\Tests;
namespace Drupal\Tests\ckeditor\Kernel;
use Drupal\editor\Entity\Editor;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\filter\Entity\FilterFormat;
/**
......
......@@ -2,12 +2,12 @@
/**
* @file
* Contains \Drupal\ckeditor\Tests\CKEditorTest.
* Contains \Drupal\Tests\ckeditor\Kernel\CKEditorTest.
*/
namespace Drupal\ckeditor\Tests;
namespace Drupal\Tests\ckeditor\Kernel;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\editor\Entity\Editor;
use Drupal\filter\Entity\FilterFormat;
......
......@@ -2,14 +2,15 @@
/**
* @file
* Contains \Drupal\comment\Tests\CommentDefaultFormatterCacheTagsTest.
* Contains \Drupal\Tests\comment\Kernel\CommentDefaultFormatterCacheTagsTest.
*/
namespace Drupal\comment\Tests;
namespace Drupal\Tests\comment\Kernel;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\Core\Cache\Cache;
use Drupal\comment\CommentInterface;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
use Drupal\comment\Entity\Comment;
......@@ -21,7 +22,7 @@
*
* @group comment
*/
class CommentDefaultFormatterCacheTagsTest extends EntityUnitTestBase {
class CommentDefaultFormatterCacheTagsTest extends EntityKernelTestBase {
use CommentTestTrait;
......
<?php
/**
* @file
* Contains \Drupal\comment\Tests\CommentFieldAccessTest.
* Contains \Drupal\Tests\comment\Kernel\CommentFieldAccessTest.
*/
namespace Drupal\comment\Tests;
namespace Drupal\Tests\comment\Kernel;
use Drupal\comment\Entity\Comment;
use Drupal\comment\Entity\CommentType;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\simpletest\TestBase;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;
......@@ -23,7 +24,7 @@
* @group comment
* @group Access
*/
class CommentFieldAccessTest extends EntityUnitTestBase {
class CommentFieldAccessTest extends EntityKernelTestBase {
use CommentTestTrait;
......
......@@ -2,13 +2,13 @@
/**
* @file
* Contains \Drupal\comment\Tests\CommentStringIdEntitiesTest.
* Contains \Drupal\Tests\comment\Kernel\CommentStringIdEntitiesTest.
*/
namespace Drupal\comment\Tests;
namespace Drupal\Tests\comment\Kernel;
use Drupal\comment\Entity\CommentType;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/**
......
......@@ -2,14 +2,14 @@
/**
* @file
* Contains \Drupal\comment\Tests\CommentValidationTest.
* Contains \Drupal\Tests\comment\Kernel\CommentValidationTest.
*/
namespace Drupal\comment\Tests;
namespace Drupal\Tests\comment\Kernel;
use Drupal\comment\CommentInterface;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\node\Entity\Node;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Drupal\user\Entity\User;
/**
......@@ -17,7 +17,7 @@
*
* @group comment
*/
class CommentValidationTest extends EntityUnitTestBase {
class CommentValidationTest extends EntityKernelTestBase {
/**
* Modules to install.
......
......@@ -13,7 +13,7 @@
* Provides test assertions for testing config entity synchronization.
*
* Can be used by test classes that extend \Drupal\simpletest\WebTestBase or
* \Drupal\simpletest\KernelTestBase.
* \Drupal\KernelTests\KernelTestBase.
*/
trait AssertConfigEntityImportTrait {
......
<?php
/**
* @file
* Contains \Drupal\contact\Tests\MessageEntityTest.
* Contains \Drupal\Tests\contact\Kernel\MessageEntityTest.
*/
namespace Drupal\contact\Tests;
namespace Drupal\Tests\contact\Kernel;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
/**
* Tests the message entity class.
......@@ -14,7 +14,7 @@
* @group contact
* @see \Drupal\contact\Entity\Message
*/
class MessageEntityTest extends EntityUnitTestBase {
class MessageEntityTest extends EntityKernelTestBase {
/**
* Modules to enable.
......
......@@ -2,14 +2,14 @@
/**
* @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;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests content translation updates performed during config import.
......
......@@ -2,12 +2,12 @@
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationSettingsApiTest.
* Contains \Drupal\Tests\content_translation\Kernel\ContentTranslationSettingsApiTest.
*/
namespace Drupal\content_translation\Tests;
namespace Drupal\Tests\content_translation\Kernel;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the content translation settings API.
......
......@@ -2,13 +2,13 @@
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationSyncUnitTest.
* Contains \Drupal\Tests\content_translation\Kernel\ContentTranslationSyncUnitTest.
*/
namespace Drupal\content_translation\Tests;
namespace Drupal\Tests\content_translation\Kernel;
use Drupal\simpletest\KernelTestBase;
use Drupal\content_translation\FieldTranslationSynchronizer;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the field synchronization logic.
......
......@@ -2,12 +2,12 @@
/**
* @file
* Contains \Drupal\contextual\Tests\ContextualUnitTest.
* Contains \Drupal\Tests\contextual\Kernel\ContextualUnitTest.
*/
namespace Drupal\contextual\Tests;
namespace Drupal\Tests\contextual\Kernel;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests all edge cases of converting from #contextual_links to ids and vice
......
<?php
/**
* @file
* Contains \Drupal\dblog\Tests\DbLogFormInjectionTest.
* Contains \Drupal\Tests\dblog\Kernel\DbLogFormInjectionTest.
*/
namespace Drupal\dblog\Tests;
namespace Drupal\Tests\dblog\Kernel;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\Form\FormInterface;
use Drupal\Core\Form\FormState;
use Drupal\Core\Form\FormStateInterface;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\user\Entity\User;
/**
......
......@@ -2,15 +2,15 @@
/**
* @file
* Contains \Drupal\editor\Tests\EditorFileReferenceFilterTest.
* Contains \Drupal\Tests\editor\Kernel\EditorFileReferenceFilterTest.
*/
namespace Drupal\editor\Tests;
namespace Drupal\Tests\editor\Kernel;
use Drupal\Core\Cache\Cache;
use Drupal\file\Entity\File;
use Drupal\simpletest\KernelTestBase;
use Drupal\filter\FilterPluginCollection;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests Editor module's file reference filter.
......
......@@ -2,16 +2,16 @@
/**
* @file
* Contains \Drupal\editor\Tests\EditorFileUsageTest.
* Contains \Drupal\Tests\editor\Kernel\EditorFileUsageTest.
*/
namespace Drupal\editor\Tests;
namespace Drupal\Tests\editor\Kernel;
use Drupal\editor\Entity\Editor;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\file\Entity\File;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\filter\Entity\FilterFormat;
......@@ -21,7 +21,7 @@
*
* @group editor
*/
class EditorFileUsageTest extends EntityUnitTestBase {
class EditorFileUsageTest extends EntityKernelTestBase {
/**
* Modules to enable.
......
......@@ -2,24 +2,24 @@
/**
* @file
* Contains \Drupal\editor\Tests\EditorImageDialogTest.
* Contains \Drupal\Tests\editor\Kernel\EditorImageDialogTest.
*/
namespace Drupal\editor\Tests;
namespace Drupal\Tests\editor\Kernel;
use Drupal\Core\Form\FormState;
use Drupal\editor\Entity\Editor;
use Drupal\editor\Form\EditorImageDialog;
use Drupal\filter\Entity\FilterFormat;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\node\Entity\NodeType;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
/**
* Tests EditorImageDialog validation and conversion functionality.
*
* @group editor
*/
class EditorImageDialogTest extends EntityUnitTestBase {
class EditorImageDialogTest extends EntityKernelTestBase {
/**
* Filter format for testing.
......
......@@ -2,14 +2,14 @@
/**
* @file
* Contains \Drupal\editor\Tests\EditorManagerTest.
* Contains \Drupal\Tests\editor\Kernel\EditorManagerTest.
*/
namespace Drupal\editor\Tests;
namespace Drupal\Tests\editor\Kernel;
use Drupal\editor\Entity\Editor;
use Drupal\simpletest\KernelTestBase;
use Drupal\filter\Entity\FilterFormat;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests detection of text editors and correct generation of attachments.
......
......@@ -2,16 +2,16 @@
/**
* @file
* Contains \Drupal\field\Tests\Entity\Update\SqlContentEntityStorageSchemaColumnTest.
* Contains \Drupal\Tests\field\Kernel\Entity\Update\SqlContentEntityStorageSchemaColumnTest.
*/
namespace Drupal\field\Tests\Entity\Update;
namespace Drupal\Tests\field\Kernel\Entity\Update;
use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException;
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 that schema changes in fields with data are detected during updates.
......
......@@ -2,18 +2,19 @@
/**
* @file
* Contains \Drupal\field\Tests\EntityReference\EntityReferenceFormatterTest.
* Contains \Drupal\Tests\field\Kernel\EntityReference\EntityReferenceFormatterTest.
*/
namespace Drupal\field\Tests\EntityReference;
namespace Drupal\Tests\field\Kernel\EntityReference;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\filter\Entity\FilterFormat;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;
use Drupal\entity_test\Entity\EntityTestLabel;
......@@ -23,7 +24,7 @@
*
* @group entity_reference
*/
class EntityReferenceFormatterTest extends EntityUnitTestBase {
class EntityReferenceFormatterTest extends EntityKernelTestBase {
use EntityReferenceTestTrait;
......
......@@ -2,15 +2,16 @@
/**
* @file
* Contains \Drupal\field\Tests\EntityReference\EntityReferenceSettingsTest.
* Contains \Drupal\Tests\field\Kernel\EntityReference\EntityReferenceSettingsTest.
*/
namespace Drupal\field\Tests\EntityReference;
namespace Drupal\Tests\field\Kernel\EntityReference;
use Drupal\Component\Utility\Unicode;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\node\Entity\NodeType;
use Drupal\simpletest\KernelTestBase;