Issue #3041755 by Hardik_Patel_12, claudiu.cristea, Lendude, Spokje, smustgrave, amateescu, alexpott, longwave: Convert HandlerAllTest into a kernel test
parent
ae750411d1
commit
eb2baa20ef
|
@ -1,9 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Drupal\Tests\views\Functional\Handler;
|
namespace Drupal\Tests\views\Kernel\Handler;
|
||||||
|
|
||||||
|
use Drupal\comment\Entity\CommentType;
|
||||||
use Drupal\comment\Tests\CommentTestTrait;
|
use Drupal\comment\Tests\CommentTestTrait;
|
||||||
use Drupal\Tests\views\Functional\ViewTestBase;
|
use Drupal\field\Entity\FieldStorageConfig;
|
||||||
|
use Drupal\node\Entity\NodeType;
|
||||||
|
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
|
||||||
use Drupal\views\Plugin\views\filter\NumericFilter;
|
use Drupal\views\Plugin\views\filter\NumericFilter;
|
||||||
use Drupal\views\ViewExecutable;
|
use Drupal\views\ViewExecutable;
|
||||||
use Drupal\views\Plugin\views\HandlerBase;
|
use Drupal\views\Plugin\views\HandlerBase;
|
||||||
|
@ -15,28 +18,34 @@ use Drupal\views\Entity\View;
|
||||||
*
|
*
|
||||||
* @group views
|
* @group views
|
||||||
*/
|
*/
|
||||||
class HandlerAllTest extends ViewTestBase {
|
class HandlerAllTest extends ViewsKernelTestBase {
|
||||||
|
|
||||||
use CommentTestTrait;
|
use CommentTestTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modules to enable.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
protected static $modules = [
|
protected static $modules = [
|
||||||
'block',
|
'block',
|
||||||
'comment',
|
'comment',
|
||||||
'contact',
|
'contact',
|
||||||
|
'dblog',
|
||||||
'field',
|
'field',
|
||||||
'filter',
|
'filter',
|
||||||
'file',
|
'file',
|
||||||
|
'forum',
|
||||||
'history',
|
'history',
|
||||||
|
'image',
|
||||||
'language',
|
'language',
|
||||||
'locale',
|
'locale',
|
||||||
|
'media',
|
||||||
'node',
|
'node',
|
||||||
'search',
|
'search',
|
||||||
|
'system',
|
||||||
|
'options',
|
||||||
'taxonomy',
|
'taxonomy',
|
||||||
|
'text',
|
||||||
|
'tracker',
|
||||||
'user',
|
'user',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -48,8 +57,26 @@ class HandlerAllTest extends ViewTestBase {
|
||||||
/**
|
/**
|
||||||
* Tests most of the handlers.
|
* Tests most of the handlers.
|
||||||
*/
|
*/
|
||||||
public function testHandlers() {
|
public function testHandlers(): void {
|
||||||
$this->drupalCreateContentType(['type' => 'article']);
|
$this->installEntitySchema('comment');
|
||||||
|
$this->installEntitySchema('file');
|
||||||
|
$this->installEntitySchema('media');
|
||||||
|
$this->installEntitySchema('node');
|
||||||
|
$this->installEntitySchema('taxonomy_term');
|
||||||
|
$this->installEntitySchema('user');
|
||||||
|
$this->installSchema('file', ['file_usage']);
|
||||||
|
$this->installSchema('forum', ['forum_index']);
|
||||||
|
$this->installSchema('dblog', ['watchdog']);
|
||||||
|
$this->installSchema('tracker', ['tracker_user']);
|
||||||
|
// Create the comment body field storage.
|
||||||
|
FieldStorageConfig::create([
|
||||||
|
'type' => 'text_long',
|
||||||
|
'entity_type' => 'comment',
|
||||||
|
'field_name' => 'comment_body',
|
||||||
|
])->save();
|
||||||
|
|
||||||
|
NodeType::create(['type' => 'article', 'name' => 'Article'])->save();
|
||||||
|
CommentType::create(['id' => 'comment', 'label' => 'Default comment', 'target_entity_type_id' => 'node'])->save();
|
||||||
$this->addDefaultCommentField('node', 'article');
|
$this->addDefaultCommentField('node', 'article');
|
||||||
|
|
||||||
$object_types = array_keys(ViewExecutable::getHandlerTypes());
|
$object_types = array_keys(ViewExecutable::getHandlerTypes());
|
||||||
|
@ -58,8 +85,8 @@ class HandlerAllTest extends ViewTestBase {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$view = View::create(['base_table' => $base_table]);
|
$view_config = View::create(['base_table' => $base_table]);
|
||||||
$view = $view->getExecutable();
|
$view = $view_config->getExecutable();
|
||||||
|
|
||||||
// @todo The groupwise relationship is currently broken.
|
// @todo The groupwise relationship is currently broken.
|
||||||
$exclude[] = 'taxonomy_term_field_data:tid_representative';
|
$exclude[] = 'taxonomy_term_field_data:tid_representative';
|
Loading…
Reference in New Issue