EntityViewsMultiValueBaseFieldDataUpdateTest.php in Drupal 8
File
core/modules/views/tests/src/Functional/Update/EntityViewsMultiValueBaseFieldDataUpdateTest.php
View source
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Views;
class EntityViewsMultiValueBaseFieldDataUpdateTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.views-entity-views-data-2846614.php',
];
}
public function testUpdateMultiValueBaseFields() {
$this
->runUpdates();
$view = Views::getView('test_user_multi_value');
$display = $view->storage
->get('display');
foreach ([
'fields',
'filters',
'arguments',
] as $type) {
$handler_config = $display['default']['display_options'][$type]['roles'];
$this
->assertEqual('roles', $handler_config['id']);
$this
->assertEqual('roles_target_id', $handler_config['field']);
$this
->assertEqual('user__roles', $handler_config['table']);
$this
->assertEqual($type === 'arguments' ? 'user__roles_rid' : 'user_roles', $handler_config['plugin_id']);
if ($type === 'filters') {
$this
->assertTrue(is_array($handler_config['value']));
$this
->assertEquals('or', $handler_config['operator']);
}
}
}
}