$tid =
$view->result
[0
]->_entity->
id();
$vocabulary = Vocabulary::
load($this->terms
[$tid]->
bundle());
$expected =
$vocabulary->
get('name'
);
$this->
assertEquals($expected,
$actual, 'Displayed vocabulary name should match that loaded from the term.'
);
$this->
assertEquals('aaa',
$vocabulary->
id(), 'First result should be vocabulary "aaa", due to ASC sorting.'
);
// Reverse sorting.
$view = Views::
getView('test_taxonomy_vid_field'
);
$view->
setHandlerOption('default', 'sort', 'vid', 'order', 'DESC'
);
$this->
executeView($view);
$actual =
$renderer->
executeInRenderContext(new RenderContext(),
function D
) use ($view) { return $view->field
['vid'
]->
advancedRender($view->result
[0
]);
});
$tid =
$view->result
[0
]->_entity->
id();
$vocabulary = Vocabulary::
load($this->terms
[$tid]->
bundle());
$expected =
$vocabulary->
get('name'
);
$this->
assertEquals($expected,
$actual, 'Displayed vocabulary name should match that loaded from the term.'
);
$this->
assertEquals('bbb',
$vocabulary->
id(), 'First result should be vocabulary "bbb", due to DESC sorting.'
);
}