RelationshipRepresentativeNodeTest.php

Same filename in this branch
  1. 9 core/modules/user/tests/src/Kernel/Views/RelationshipRepresentativeNodeTest.php
Same filename in other branches
  1. 8.9.x core/modules/taxonomy/tests/src/Functional/Views/RelationshipRepresentativeNodeTest.php
  2. 8.9.x core/modules/user/tests/src/Kernel/Views/RelationshipRepresentativeNodeTest.php
  3. 10 core/modules/taxonomy/tests/src/Kernel/Views/RelationshipRepresentativeNodeTest.php
  4. 10 core/modules/user/tests/src/Kernel/Views/RelationshipRepresentativeNodeTest.php
  5. 11.x core/modules/taxonomy/tests/src/Kernel/Views/RelationshipRepresentativeNodeTest.php
  6. 11.x core/modules/user/tests/src/Kernel/Views/RelationshipRepresentativeNodeTest.php

Namespace

Drupal\Tests\taxonomy\Functional\Views

File

core/modules/taxonomy/tests/src/Functional/Views/RelationshipRepresentativeNodeTest.php

View source
<?php

namespace Drupal\Tests\taxonomy\Functional\Views;

use Drupal\views\Views;

/**
 * Tests the representative node relationship for terms.
 *
 * @group taxonomy
 */
class RelationshipRepresentativeNodeTest extends TaxonomyTestBase {
    
    /**
     * Views used by this test.
     *
     * @var array
     */
    public static $testViews = [
        'test_groupwise_term',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * Tests the relationship.
     */
    public function testRelationship() {
        $view = Views::getView('test_groupwise_term');
        $this->executeView($view);
        $map = [
            'node_field_data_taxonomy_term_field_data_nid' => 'nid',
            'tid' => 'tid',
        ];
        $expected_result = [
            [
                'nid' => $this->nodes[1]
                    ->id(),
                'tid' => $this->term2
                    ->id(),
            ],
            [
                'nid' => $this->nodes[1]
                    ->id(),
                'tid' => $this->term1
                    ->id(),
            ],
        ];
        $this->assertIdenticalResultset($view, $expected_result, $map);
    }

}

Classes

Title Deprecated Summary
RelationshipRepresentativeNodeTest Tests the representative node relationship for terms.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.