Commit ee9f19cf authored by alexpott's avatar alexpott

Issue #2553655 by dawehner, Berdir, martin107: Convert ViewKernelTestBase to use KernelTestBaseTNG

parent e6f491d8
......@@ -49,6 +49,10 @@ public function __sleep() {
* {@inheritdoc}
*/
public function __wakeup() {
// Tests in isolation potentially unserialize in the parent process.
if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP']) && !\Drupal::hasContainer()) {
return;
}
$container = \Drupal::getContainer();
foreach ($this->_serviceIds as $key => $service_id) {
$this->$key = $container->get($service_id);
......
......@@ -2,13 +2,13 @@
/**
* @file
* Contains \Drupal\aggregator\Tests\Views\AggregatorFeedViewsFieldAccessTest.
* Contains \Drupal\Tests\aggregator\Kernel\Views\AggregatorFeedViewsFieldAccessTest.
*/
namespace Drupal\aggregator\Tests\Views;
namespace Drupal\Tests\aggregator\Kernel\Views;
use Drupal\aggregator\Entity\Feed;
use Drupal\views\Tests\Handler\FieldFieldAccessTestBase;
use Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase;
/**
* Tests base field access in Views for the aggregator_feed entity.
......
......@@ -2,14 +2,14 @@
/**
* @file
* Contains \Drupal\aggregator\Tests\Views\AggregatorItemViewsFieldAccessTest.
* Contains \Drupal\Tests\aggregator\Kernel\Views\AggregatorItemViewsFieldAccessTest.
*/
namespace Drupal\aggregator\Tests\Views;
namespace Drupal\Tests\aggregator\Kernel\Views;
use Drupal\aggregator\Entity\Feed;
use Drupal\aggregator\Entity\Item;
use Drupal\views\Tests\Handler\FieldFieldAccessTestBase;
use Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase;
/**
* Tests base field access in Views for the aggregator_item entity.
......
......@@ -2,24 +2,24 @@
/**
* @file
* Contains \Drupal\aggregator\Tests\Views\IntegrationTest.
* Contains \Drupal\Tests\aggregator\Kernel\Views\IntegrationTest.
*/
namespace Drupal\aggregator\Tests\Views;
namespace Drupal\Tests\aggregator\Kernel\Views;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Render\RenderContext;
use Drupal\Core\Url;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\views\Views;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Tests\ViewKernelTestBase;
/**
* Tests basic integration of views data from the aggregator module.
*
* @group aggregator
*/
class IntegrationTest extends ViewKernelTestBase {
class IntegrationTest extends ViewsKernelTestBase {
/**
* Modules to install.
......@@ -52,7 +52,7 @@ class IntegrationTest extends ViewKernelTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp($import_test_views = TRUE) {
parent::setUp();
$this->installEntitySchema('aggregator_item');
......@@ -120,7 +120,7 @@ public function testAggregatorItemView() {
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($view, $row) {
return $view->field['title']->advancedRender($row);
});
$this->assertEqual($output, $expected_link, 'Ensure the right link is generated');
$this->assertEqual($output, $expected_link->getGeneratedLink(), 'Ensure the right link is generated');
$expected_author = Xss::filter($items[$iid]->getAuthor(), _aggregator_allowed_tags());
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($view, $row) {
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\comment\Tests\Views\CommentLinksTest.
* Contains \Drupal\Tests\comment\Kernel\Views\CommentLinksTest.
*/
namespace Drupal\comment\Tests\Views;
namespace Drupal\Tests\comment\Kernel\Views;
use Drupal\comment\CommentInterface;
use Drupal\comment\CommentManagerInterface;
......@@ -21,7 +21,7 @@
*
* @group comment
*/
class CommentLinksTest extends CommentViewKernelTestBase {
class CommentLinksTest extends CommentViewsKernelTestBase {
/**
* Views used by this test.
......
......@@ -2,17 +2,17 @@
/**
* @file
* Contains \Drupal\comment\Tests\Views\CommentUserNameTest.
* Contains \Drupal\Tests\comment\Kernel\Views\CommentUserNameTest.
*/
namespace Drupal\comment\Tests\Views;
namespace Drupal\Tests\comment\Kernel\Views;
use Drupal\comment\Entity\Comment;
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\user\Entity\Role;
use Drupal\user\Entity\User;
use Drupal\views\Entity\View;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\views\Views;
/**
......@@ -20,7 +20,7 @@
*
* @group comment
*/
class CommentUserNameTest extends ViewKernelTestBase {
class CommentUserNameTest extends ViewsKernelTestBase {
/**
* Admin user.
......
......@@ -2,14 +2,14 @@
/**
* @file
* Contains \Drupal\comment\Tests\Views\CommentViewsFieldAccessTest.
* Contains \Drupal\Tests\comment\Kernel\Views\CommentViewsFieldAccessTest.
*/
namespace Drupal\comment\Tests\Views;
namespace Drupal\Tests\comment\Kernel\Views;
use Drupal\comment\Entity\Comment;
use Drupal\user\Entity\User;
use Drupal\views\Tests\Handler\FieldFieldAccessTestBase;
use Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase;
/**
* Tests base field access in Views for the comment entity.
......
......@@ -2,19 +2,19 @@
/**
* @file
* Contains \Drupal\comment\Tests\Views\CommentViewKernelTestBase.
* Contains \Drupal\Tests\comment\Kernel\Views\CommentViewsKernelTestBase.
*/
namespace Drupal\comment\Tests\Views;
namespace Drupal\Tests\comment\Kernel\Views;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\user\Entity\Role;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\views\Tests\ViewTestData;
/**
* Provides a common test base for comment views tests.
*/
abstract class CommentViewKernelTestBase extends ViewKernelTestBase {
abstract class CommentViewsKernelTestBase extends ViewsKernelTestBase {
/**
* Modules to enable.
......
......@@ -2,25 +2,25 @@
/**
* @file
* Contains \Drupal\dblog\Tests\Views\ViewsIntegrationTest.
* Contains \Drupal\Tests\dblog\Kernel\Views\ViewsIntegrationTest.
*/
namespace Drupal\dblog\Tests\Views;
namespace Drupal\Tests\dblog\Kernel\Views;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Core\Url;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\views\Views;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Tests\ViewKernelTestBase;
/**
* Tests the views integration of dblog module.
*
* @group dblog
*/
class ViewsIntegrationTest extends ViewKernelTestBase {
class ViewsIntegrationTest extends ViewsKernelTestBase {
/**
* Views used by this test.
......@@ -39,7 +39,7 @@ class ViewsIntegrationTest extends ViewKernelTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp($import_test_views = TRUE) {
parent::setUp();
// Rebuild the router, otherwise we can't generate links.
......
......@@ -2,16 +2,16 @@
/**
* @file
* Contains \Drupal\field\Tests\EntityReference\Views\EntityReferenceRelationshipTest.
* Contains \Drupal\Tests\field\Kernel\EntityReference\Views\EntityReferenceRelationshipTest.
*/
namespace Drupal\field\Tests\EntityReference\Views;
namespace Drupal\Tests\field\Kernel\EntityReference\Views;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\entity_test\Entity\EntityTestMul;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\views\Views;
/**
......@@ -21,7 +21,7 @@
*
* @see core_field_views_data()
*/
class EntityReferenceRelationshipTest extends ViewKernelTestBase {
class EntityReferenceRelationshipTest extends ViewsKernelTestBase {
use EntityReferenceTestTrait;
......@@ -54,7 +54,7 @@ class EntityReferenceRelationshipTest extends ViewKernelTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp($import_test_views = TRUE) {
parent::setUp();
$this->installEntitySchema('user');
......
......@@ -2,15 +2,15 @@
/**
* @file
* Contains \Drupal\file\Tests\Views\ExtensionViewsFieldTest.
* Contains \Drupal\Tests\file\Kernel\Views\ExtensionViewsFieldTest.
*/
namespace Drupal\file\Tests\Views;
namespace Drupal\Tests\file\Kernel\Views;
use Drupal\Core\Render\RenderContext;
use Drupal\file\Entity\File;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\views\Views;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\views\Tests\ViewTestData;
/**
......@@ -18,7 +18,7 @@
*
* @group file
*/
class ExtensionViewsFieldTest extends ViewKernelTestBase {
class ExtensionViewsFieldTest extends ViewsKernelTestBase {
/**
* {@inheritdoc}
......@@ -35,7 +35,7 @@ class ExtensionViewsFieldTest extends ViewKernelTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp($import_test_views = TRUE) {
parent::setUp();
ViewTestData::createTestViews(get_class($this), array('file_test_views'));
......
......@@ -2,15 +2,15 @@
/**
* @file
* Contains \Drupal\file\Tests\Views\FileViewsFieldAccessTest.
* Contains \Drupal\Tests\file\Kernel\Views\FileViewsFieldAccessTest.
*/
namespace Drupal\file\Tests\Views;
namespace Drupal\Tests\file\Kernel\Views;
use Drupal\file\Entity\File;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\user\Entity\User;
use Drupal\views\Tests\Handler\FieldFieldAccessTestBase;
use Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase;
/**
* Tests base field access in Views for the file entity.
......
......@@ -2,14 +2,14 @@
/**
* @file
* Contains \Drupal\image\Tests\Views\ImageViewsDataTest.
* Contains \Drupal\Tests\image\Kernel\Views\ImageViewsDataTest.
*/
namespace Drupal\image\Tests\Views;
namespace Drupal\Tests\image\Kernel\Views;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldConfig;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\views\Views;
/**
......@@ -17,7 +17,7 @@
*
* @group image
*/
class ImageViewsDataTest extends ViewKernelTestBase {
class ImageViewsDataTest extends ViewsKernelTestBase {
/**
* Modules to install.
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\language\Tests\Views\ArgumentLanguageTest.
* Contains \Drupal\Tests\language\Kernel\Views\ArgumentLanguageTest.
*/
namespace Drupal\language\Tests\Views;
namespace Drupal\Tests\language\Kernel\Views;
use Drupal\views\Views;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\language\Tests\Views\FieldLanguageTest.
* Contains \Drupal\Tests\language\Kernel\Views\FieldLanguageTest.
*/
namespace Drupal\language\Tests\Views;
namespace Drupal\Tests\language\Kernel\Views;
use Drupal\views\Views;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\language\Tests\Views\FilterLanguageTest.
* Contains \Drupal\Tests\language\Kernel\Views\FilterLanguageTest.
*/
namespace Drupal\language\Tests\Views;
namespace Drupal\Tests\language\Kernel\Views;
use Drupal\views\Views;
......
......@@ -2,18 +2,18 @@
/**
* @file
* Contains \Drupal\language\Tests\Views\LanguageTestBase.
* Contains \Drupal\Tests\language\Kernel\Views\LanguageTestBase.
*/
namespace Drupal\language\Tests\Views;
namespace Drupal\Tests\language\Kernel\Views;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
/**
* Defines the base class for all Language handler tests.
*/
abstract class LanguageTestBase extends ViewKernelTestBase {
abstract class LanguageTestBase extends ViewsKernelTestBase {
/**
* Modules to enable.
......@@ -22,7 +22,7 @@ abstract class LanguageTestBase extends ViewKernelTestBase {
*/
public static $modules = array('system', 'language');
protected function setUp() {
protected function setUp($import_test_views = TRUE) {
parent::setUp();
$this->installConfig(array('language'));
......
......@@ -2,13 +2,13 @@
/**
* @file
* Contains \Drupal\node\Tests\Views\NidArgumentTest.
* Contains \Drupal\Tests\node\Kernel\Views\NidArgumentTest.
*/
namespace Drupal\node\Tests\Views;
namespace Drupal\Tests\node\Kernel\Views;
use Drupal\node\Entity\Node;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Views;
......@@ -18,7 +18,7 @@
* @group node
* @see \Drupal\node\Plugin\views\argument\Nid
*/
class NidArgumentTest extends ViewKernelTestBase {
class NidArgumentTest extends ViewsKernelTestBase {
/**
* {@inheritdoc}
......
......@@ -2,15 +2,15 @@
/**
* @file
* Contains \Drupal\node\Tests\Views\NodeViewsFieldAccessTest.
* Contains \Drupal\Tests\node\Kernel\Views\NodeViewsFieldAccessTest.
*/
namespace Drupal\node\Tests\Views;
namespace Drupal\Tests\node\Kernel\Views;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\user\Entity\User;
use Drupal\views\Tests\Handler\FieldFieldAccessTestBase;
use Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase;
/**
* Tests base field access in Views for the node entity.
......
......@@ -2,14 +2,14 @@
/**
* @file
* Contains \Drupal\node\Tests\Views\RevisionCreateTimestampTest.
* Contains \Drupal\Tests\node\Kernel\Views\RevisionCreateTimestampTest.
*/
namespace Drupal\node\Tests\Views;
namespace Drupal\Tests\node\Kernel\Views;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Views;
......@@ -18,7 +18,7 @@
*
* @group views
*/
class RevisionCreateTimestampTest extends ViewKernelTestBase {
class RevisionCreateTimestampTest extends ViewsKernelTestBase {
/**
* {@inheritdoc}
......
......@@ -2,14 +2,14 @@
/**
* @file
* Contains \Drupal\file\Tests\Views\FileViewsDataTest.
* Contains \Drupal\Tests\options\Kernel\Views\FileViewsDataTest.
*/
namespace Drupal\file\Tests\Views;
namespace Drupal\Tests\options\Kernel\Views;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldConfig;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\views\Views;
/**
......@@ -17,7 +17,7 @@
*
* @group file
*/
class FileViewsDataTest extends ViewKernelTestBase {
class FileViewsDataTest extends ViewsKernelTestBase {
/**
* Modules to install.
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\options\Tests\Views\OptionsListArgumentTest.
* Contains \Drupal\Tests\options\Kernel\Views\OptionsListArgumentTest.
*/
namespace Drupal\options\Tests\Views;
namespace Drupal\Tests\options\Kernel\Views;
use Drupal\views\Views;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\options\Tests\Views\OptionsListFilterTest.
* Contains \Drupal\Tests\options\Kernel\Views\OptionsListFilterTest.
*/
namespace Drupal\options\Tests\Views;
namespace Drupal\Tests\options\Kernel\Views;
use Drupal\views\Views;
......
......@@ -2,22 +2,22 @@
/**
* @file
* Contains \Drupal\options\Tests\Views\OptionsTestBase.
* Contains \Drupal\Tests\options\Kernel\Views\OptionsTestBase.
*/
namespace Drupal\options\Tests\Views;
namespace Drupal\Tests\options\Kernel\Views;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Tests\ViewKernelTestBase;
/**
* Base class for options views tests.
*/
abstract class OptionsTestBase extends ViewKernelTestBase {
abstract class OptionsTestBase extends ViewsKernelTestBase {
/**
* Modules to enable.
......@@ -47,7 +47,7 @@ abstract class OptionsTestBase extends ViewKernelTestBase {
*/
protected $fieldNames;
protected function setUp() {
protected function setUp($import_test_views = TRUE) {
parent::setUp();
$this->mockStandardInstall();
......
<?php
/**
* @file
* Contains \Drupal\options\Tests\Views\ViewsDataTest.
* Contains \Drupal\Tests\options\Kernel\Views\ViewsDataTest.
*/
namespace Drupal\options\Tests\Views;
namespace Drupal\Tests\options\Kernel\Views;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
......@@ -31,7 +31,7 @@ class ViewsDataTest extends OptionsTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp($import_test_views = TRUE) {
parent::setUp();
$field_name = 'test_options';
......
......@@ -2,14 +2,14 @@
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\TaxonomyViewsFieldAccessTest.
* Contains \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyViewsFieldAccessTest.
*/
namespace Drupal\taxonomy\Tests\Views;
namespace Drupal\Tests\taxonomy\Kernel\Views;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\views\Tests\Handler\FieldFieldAccessTestBase;
use Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase;
/**
* Tests base field access in Views for the taxonomy entity.
......
......@@ -2,11 +2,12 @@
/**
* @file
* Contains \Drupal\user\Tests\Views\HandlerFieldPermissionTest.
* Contains \Drupal\Tests\user\Kernel\Views\HandlerFieldPermissionTest.
*/
namespace Drupal\user\Tests\Views;
namespace Drupal\Tests\user\Kernel\Views;
use Drupal\Tests\user\Kernel\Views\UserKernelTestBase;
use Drupal\views\Views;
/**
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\user\Tests\Views\HandlerFilterPermissionTest.
* Contains \Drupal\Tests\user\Kernel\Views\HandlerFilterPermissionTest.
*/
namespace Drupal\user\Tests\Views;
namespace Drupal\Tests\user\Kernel\Views;
use Drupal\Component\Utility\Html;
use Drupal\views\Views;
......
......@@ -2,11 +2,12 @@
/**
* @file
* Contains \Drupal\user\Tests\Views\HandlerFilterRolesTest.
* Contains \Drupal\Tests\user\Kernel\Views\HandlerFilterRolesTest.
*/
namespace Drupal\user\Tests\Views;
namespace Drupal\Tests\user\Kernel\Views;
use Drupal\Tests\user\Kernel\Views\UserKernelTestBase;
use Drupal\user\Entity\Role;
use Drupal\views\Entity\View;
use Drupal\views\Views;
......