Skip to content
Snippets Groups Projects
Commit 5ac65f8c authored by catch's avatar catch
Browse files

Issue #3414481 by Spokje: Convert PathPluginTest into a Kernel test

(cherry picked from commit 17463191)
parent 3d2f1509
Branches
Tags
14 merge requests!8376Drupal views: adding more granularity to the ‘use ajax’ functionality,!8300Issue #3443586 View area displays even when parent view has no results.,!7567Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7565Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7509Change label "Block description" to "Block type",!7344Issue #3292350 by O'Briat, KlemenDEV, hswong3i, smustgrave, quietone: Update...,!6922Issue #3412959 by quietone, smustgrave, longwave: Fix 12 'un' words,!6848Issue #3417553 by longwave: Remove withConsecutive() in CacheCollectorTest,!6720Revert "Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave:...,!6560Update ClaroPreRender.php, confirming classes provided are in array format,!6528Issue #3414261 by catch: Add authenticated user umami performance tests,!6501Issue #3263668 by omkar-pd, Wim Leers, hooroomoo: Re-enable inline form errors...,!6354Draft: Issue #3380392 by phma: Updating language weight from the overview reverts label if translated,!6324Issue #3416723 by Ludo.R: Provide a "node type" views default argument
Pipeline #79500 passed
Pipeline: drupal

#79501

    <?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;
    /**
    ......@@ -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']);
    \Drupal::currentUser()->setAccount($this->createUser(['access content']));
    $this->drupalCreateContentType(['type' => 'article']);
    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');
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment