function ModuleTest::testviews_get_handler in Views (for Drupal 7) 8.3
Tests the views_get_handler method.
File
- lib/
Drupal/ views/ Tests/ ModuleTest.php, line 84 - Definition of Drupal\views\Tests\ModuleTest.
Class
- ModuleTest
- Tests basic functions from the Views module.
Namespace
Drupal\views\TestsCode
function testviews_get_handler() {
$types = array(
'field',
'area',
'filter',
);
foreach ($types as $type) {
$handler = views_get_handler($this
->randomName(), $this
->randomName(), $type);
$this
->assertEqual('Drupal\\views\\Plugin\\views\\' . $type . '\\Broken', get_class($handler), t('Make sure that a broken handler of type: @type are created', array(
'@type' => $type,
)));
}
$views_data = $this
->viewsData();
$test_tables = array(
'views_test_data' => array(
'id',
'name',
),
);
foreach ($test_tables as $table => $fields) {
foreach ($fields as $field) {
$data = $views_data[$table][$field];
foreach ($data as $id => $field_data) {
if (!in_array($id, array(
'title',
'help',
))) {
$handler = views_get_handler($table, $field, $id);
$this
->assertInstanceHandler($handler, $table, $field, $id);
}
}
}
}
// Test the override handler feature.
$handler = views_get_handler('views_test_data', 'job', 'filter', 'standard');
$this
->assertEqual('Drupal\\views\\Plugin\\views\\filter\\Standard', get_class($handler));
}