function EntityViewsWithMultivalueBasefieldTest::testView

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Kernel/Entity/EntityViewsWithMultivalueBasefieldTest.php \Drupal\Tests\views\Kernel\Entity\EntityViewsWithMultivalueBasefieldTest::testView()
  2. 10 core/modules/views/tests/src/Kernel/Entity/EntityViewsWithMultivalueBasefieldTest.php \Drupal\Tests\views\Kernel\Entity\EntityViewsWithMultivalueBasefieldTest::testView()
  3. 11.x core/modules/views/tests/src/Kernel/Entity/EntityViewsWithMultivalueBaseFieldTest.php \Drupal\Tests\views\Kernel\Entity\EntityViewsWithMultivalueBaseFieldTest::testView()

Tests entity views with multivalue base fields.

File

core/modules/views/tests/src/Kernel/Entity/EntityViewsWithMultivalueBasefieldTest.php, line 38

Class

EntityViewsWithMultivalueBasefieldTest
Tests entity views with multivalue base fields.

Namespace

Drupal\Tests\views\Kernel\Entity

Code

public function testView() {
    EntityTestMultiValueBasefield::create([
        'name' => 'test',
    ])->save();
    EntityTestMultiValueBasefield::create([
        'name' => [
            'test2',
            'test3',
        ],
    ])->save();
    $view = Views::getView('test_entity_multivalue_basefield');
    $view->execute();
    $this->assertIdenticalResultset($view, [
        [
            'name' => [
                'test',
            ],
        ],
        [
            'name' => [
                'test2',
                'test3',
            ],
        ],
    ], [
        'name' => 'name',
    ]);
}

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