protected function ViewStorageTest::loadTests in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/ViewStorageTest.php \Drupal\views\Tests\ViewStorageTest::loadTests()
Tests loading configuration entities.
1 call to ViewStorageTest::loadTests()
- ViewStorageTest::testConfigurationEntityCRUD in core/
modules/ views/ src/ Tests/ ViewStorageTest.php - Tests CRUD operations.
File
- core/
modules/ views/ src/ Tests/ ViewStorageTest.php, line 85 - Contains \Drupal\views\Tests\ViewStorageTest.
Class
- ViewStorageTest
- Tests the CRUD functionality for a view.
Namespace
Drupal\views\TestsCode
protected function loadTests() {
$view = entity_load('view', 'test_view_storage');
$data = $this
->config('views.view.test_view_storage')
->get();
// Confirm that an actual view object is loaded and that it returns all of
// expected properties.
$this
->assertTrue($view instanceof View, 'Single View instance loaded.');
foreach ($this->configProperties as $property) {
$this
->assertTrue($view
->get($property) !== NULL, format_string('Property: @property loaded onto View.', array(
'@property' => $property,
)));
}
// Check the displays have been loaded correctly from config display data.
$expected_displays = array(
'default',
'block_1',
'page_1',
);
$this
->assertEqual(array_keys($view
->get('display')), $expected_displays, 'The correct display names are present.');
// Check each ViewDisplay object and confirm that it has the correct key and
// property values.
foreach ($view
->get('display') as $key => $display) {
$this
->assertEqual($key, $display['id'], 'The display has the correct ID assigned.');
// Get original display data and confirm that the display options array
// exists.
$original_options = $data['display'][$key];
foreach ($original_options as $orig_key => $value) {
$this
->assertIdentical($display[$orig_key], $value, format_string('@key is identical to saved data', array(
'@key' => $key,
)));
}
}
// Make sure that loaded default views get a UUID.
$view = Views::getView('test_view_storage');
$this
->assertTrue($view->storage
->uuid());
}