Loading core/modules/node/tests/src/Functional/Views/PathPluginTest.php→core/modules/node/tests/src/Kernel/Views/PathPluginTest.php +34 −30 Original line number Diff line number Diff line <?php namespace Drupal\Tests\node\Functional\Views; namespace Drupal\Tests\node\Kernel\Views; use Drupal\node\Entity\NodeType; use Drupal\Tests\node\Traits\NodeCreationTrait; use Drupal\Tests\user\Traits\UserCreationTrait; use Drupal\Tests\views\Kernel\ViewsKernelTestBase; use Drupal\views\Tests\ViewTestData; use Drupal\views\Views; /** Loading @@ -9,63 +14,62 @@ * * @group node */ class PathPluginTest extends NodeTestBase { class PathPluginTest extends ViewsKernelTestBase { use NodeCreationTrait; use UserCreationTrait; /** * Modules to enable. * Views used by this test. * * @var array * @var string[] */ protected static $modules = ['node']; public static $testViews = ['test_node_path_plugin']; /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; /** * Views used by this test. * * @var array */ public static $testViews = ['test_node_path_plugin']; protected static $modules = [ 'node', 'node_test_views', 'user', ]; /** * Contains all nodes used by this test. * * @var \Drupal\node\Entity\Node[] */ protected $nodes; protected array $nodes; /** * {@inheritdoc} */ protected function setUp($import_test_views = TRUE, $modules = ['node_test_views']): void { parent::setUp($import_test_views, $modules); protected function setUp($import_test_views = TRUE): void { parent::setUp($import_test_views); $this->installEntitySchema('user'); $this->installEntitySchema('node'); $this->installSchema('node', ['node_access']); ViewTestData::createTestViews(static::class, ['node_test_views']); $this->drupalCreateContentType(['type' => 'article']); \Drupal::currentUser()->setAccount($this->createUser(['access content'])); NodeType::create([ 'type' => 'article', 'name' => 'Article', ])->save(); // Create two nodes. for ($i = 0; $i < 2; $i++) { $this->nodes[] = $this->drupalCreateNode( [ 'type' => 'article', 'body' => [ [ 'value' => $this->randomMachineName(42), 'format' => filter_default_format(), 'summary' => $this->randomMachineName(), ], ], ] ); $this->nodes[] = $this->createNode(['type' => 'article']); } } /** * Tests the node path plugin functionality when converted to entity link. */ public function testPathPlugin() { public function testPathPlugin(): void { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); $view = Views::getView('test_node_path_plugin'); Loading Loading
core/modules/node/tests/src/Functional/Views/PathPluginTest.php→core/modules/node/tests/src/Kernel/Views/PathPluginTest.php +34 −30 Original line number Diff line number Diff line <?php namespace Drupal\Tests\node\Functional\Views; namespace Drupal\Tests\node\Kernel\Views; use Drupal\node\Entity\NodeType; use Drupal\Tests\node\Traits\NodeCreationTrait; use Drupal\Tests\user\Traits\UserCreationTrait; use Drupal\Tests\views\Kernel\ViewsKernelTestBase; use Drupal\views\Tests\ViewTestData; use Drupal\views\Views; /** Loading @@ -9,63 +14,62 @@ * * @group node */ class PathPluginTest extends NodeTestBase { class PathPluginTest extends ViewsKernelTestBase { use NodeCreationTrait; use UserCreationTrait; /** * Modules to enable. * Views used by this test. * * @var array * @var string[] */ protected static $modules = ['node']; public static $testViews = ['test_node_path_plugin']; /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; /** * Views used by this test. * * @var array */ public static $testViews = ['test_node_path_plugin']; protected static $modules = [ 'node', 'node_test_views', 'user', ]; /** * Contains all nodes used by this test. * * @var \Drupal\node\Entity\Node[] */ protected $nodes; protected array $nodes; /** * {@inheritdoc} */ protected function setUp($import_test_views = TRUE, $modules = ['node_test_views']): void { parent::setUp($import_test_views, $modules); protected function setUp($import_test_views = TRUE): void { parent::setUp($import_test_views); $this->installEntitySchema('user'); $this->installEntitySchema('node'); $this->installSchema('node', ['node_access']); ViewTestData::createTestViews(static::class, ['node_test_views']); $this->drupalCreateContentType(['type' => 'article']); \Drupal::currentUser()->setAccount($this->createUser(['access content'])); NodeType::create([ 'type' => 'article', 'name' => 'Article', ])->save(); // Create two nodes. for ($i = 0; $i < 2; $i++) { $this->nodes[] = $this->drupalCreateNode( [ 'type' => 'article', 'body' => [ [ 'value' => $this->randomMachineName(42), 'format' => filter_default_format(), 'summary' => $this->randomMachineName(), ], ], ] ); $this->nodes[] = $this->createNode(['type' => 'article']); } } /** * Tests the node path plugin functionality when converted to entity link. */ public function testPathPlugin() { public function testPathPlugin(): void { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); $view = Views::getView('test_node_path_plugin'); Loading