public function DataExportTest::testCalculateDependencies in Views data export 8
@covers ::calculateDependencies
File
- tests/
src/ Kernel/ Plugin/ views/ style/ DataExportTest.php, line 48
Class
- DataExportTest
- Tests the data export style serializer.
Namespace
Drupal\Tests\views_data_export\Kernel\Plugin\views\styleCode
public function testCalculateDependencies() {
/** @var \Drupal\views\ViewEntityInterface $view */
$view = View::load('test_data_export');
$display =& $view
->getDisplay('data_export_1');
$display['display_options']['defaults']['style'] = FALSE;
$display['display_options']['style']['type'] = 'data_export';
$display['display_options']['style']['options']['formats'] = [
'csv' => 'csv',
];
// Ensure these schemas are properly defined.
$display['display_options']['style']['options']['csv_settings']['delimiter'] = '\\t';
$display['display_options']['style']['options']['csv_settings']['enclosure'] = '';
$display['display_options']['style']['options']['csv_settings']['escape_char'] = '';
$display['display_options']['style']['options']['csv_settings']['strip_tags'] = TRUE;
$display['display_options']['style']['options']['csv_settings']['trim'] = TRUE;
$display['display_options']['style']['options']['csv_settings']['encoding'] = 'utf8';
$display['display_options']['style']['options']['xls_settings']['xls_format'] = 'Excel5';
$display['display_options']['style']['options']['xls_settings']['metadata'] = [
'creator' => 'J Author',
'last_modified_by' => 'That one guy, down the hall?',
'title' => 'A fantastic title. The best title.',
'description' => 'Such a great description. Everybody is saying.',
'subject' => 'This spreadsheet is about numbers.',
'keywords' => 'testing xls spreadsheets',
'category' => 'test category',
'manager' => 'J Q Manager',
'company' => 'Drupal',
];
$view
->save();
$view
->calculateDependencies();
$this
->assertEquals([
'module' => [
'csv_serialization',
'entity_test',
'rest',
'serialization',
'user',
'views_data_export',
],
], $view
->getDependencies());
}