Skip to content
Snippets Groups Projects
Verified Commit 929da61e authored by Dave Long's avatar Dave Long
Browse files

Issue #3415557 by Spokje, catch: Convert RowPluginTest into a Kernel test

parent 2eba3465
No related branches found
No related tags found
27 merge requests!12227Issue #3181946 by jonmcl, mglaman,!8528Issue #3456871 by Tim Bozeman: Support NULL services,!3878Removed unused condition head title for views,!38582585169-10.1.x,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3668Resolve #3347842 "Deprecate the trusted",!3651Issue #3347736: Create new SDC component for Olivero (header-search),!3531Issue #3336994: StringFormatter always displays links to entity even if the user in context does not have access,!3478Issue #3337882: Deleted menus are not removed from content type config,!3355Issue #3209129: Scrolling problems when adding a block via layout builder,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3133core/modules/system/css/components/hidden.module.css,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2334Issue #3228209: Add hasRole() method to AccountInterface,!2062Issue #3246454: Add weekly granularity to views date sort,!1105Issue #3025039: New non translatable field on translatable content throws error,!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493
Pipeline #82079 passed with warnings
Pipeline: drupal

#82081

    <?php <?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; use Drupal\views\Views;
    /** /**
    ...@@ -10,45 +15,61 @@ ...@@ -10,45 +15,61 @@
    * @group node * @group node
    * @see \Drupal\node\Plugin\views\row\NodeRow * @see \Drupal\node\Plugin\views\row\NodeRow
    */ */
    class RowPluginTest extends NodeTestBase { class RowPluginTest 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_row_plugin'];
    /** /**
    * {@inheritdoc} * {@inheritdoc}
    */ */
    protected $defaultTheme = 'stark'; protected static $modules = [
    'field',
    /** 'filter',
    * Views used by this test. 'node',
    * 'node_test_views',
    * @var array 'text',
    */ 'user',
    public static $testViews = ['test_node_row_plugin']; ];
    /** /**
    * Contains all nodes used by this test. * Contains all nodes used by this test.
    * *
    * @var array * @var \Drupal\node\Entity\Node[]
    */ */
    protected $nodes; protected array $nodes;
    /** /**
    * {@inheritdoc} * {@inheritdoc}
    */ */
    protected function setUp($import_test_views = TRUE, $modules = ['node_test_views']): void { protected function setUp($import_test_views = TRUE): void {
    parent::setUp($import_test_views, $modules); parent::setUp($import_test_views);
    $this->installEntitySchema('user');
    $this->installEntitySchema('node');
    $this->installSchema('node', ['node_access']);
    $this->installConfig(['field', 'filter', 'node']);
    ViewTestData::createTestViews(static::class, ['node_test_views']);
    \Drupal::currentUser()->setAccount($this->createUser(['access content']));
    $this->drupalCreateContentType(['type' => 'article']); $node_type = NodeType::create([
    'type' => 'article',
    'name' => 'Article',
    ]);
    $node_type->save();
    node_add_body_field($node_type);
    // Create two nodes. // Create two nodes.
    for ($i = 0; $i < 2; $i++) { for ($i = 0; $i < 2; $i++) {
    $this->nodes[] = $this->drupalCreateNode( $this->nodes[] = $this->createNode(
    [ [
    'type' => 'article', 'type' => 'article',
    'body' => [ 'body' => [
    ...@@ -66,7 +87,7 @@ protected function setUp($import_test_views = TRUE, $modules = ['node_test_views ...@@ -66,7 +87,7 @@ protected function setUp($import_test_views = TRUE, $modules = ['node_test_views
    /** /**
    * Tests the node row plugin. * Tests the node row plugin.
    */ */
    public function testRowPlugin() { public function testRowPlugin(): void {
    /** @var \Drupal\Core\Render\RendererInterface $renderer */ /** @var \Drupal\Core\Render\RendererInterface $renderer */
    $renderer = $this->container->get('renderer'); $renderer = $this->container->get('renderer');
    $view = Views::getView('test_node_row_plugin'); $view = Views::getView('test_node_row_plugin');
    ...@@ -89,7 +110,7 @@ public function testRowPlugin() { ...@@ -89,7 +110,7 @@ public function testRowPlugin() {
    $output = $renderer->renderRoot($output); $output = $renderer->renderRoot($output);
    foreach ($this->nodes as $node) { foreach ($this->nodes as $node) {
    $this->assertStringContainsString($node->body->summary, $output, 'Make sure the teaser appears in the output of the view.'); $this->assertStringContainsString($node->body->summary, $output, 'Make sure the teaser appears in the output of the view.');
    $this->assertStringNotContainsString($node->body->value, $output, 'Make sure the full text does not appears in the output of the view if teaser is set as viewmode.'); $this->assertStringNotContainsString($node->body->value, $output);
    } }
    } }
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment