vvf.test in Views Variable Field 7
Definition of ViewsHandlerFieldVariableTest.
File
vvf.testView source
<?php
/**
* @file
* Definition of ViewsHandlerFieldVariableTest.
*/
/**
* Tests the vvf views_handler_field_variable handler.
*/
class ViewsHandlerFieldVariableTest extends ViewsSqlTest {
public static function getInfo() {
return array(
'name' => 'Field: Variable',
'description' => 'Test the vvf views_handler_field_variable handler.',
'group' => 'Views Handlers',
);
}
public function setUp() {
parent::setUp();
module_enable(array(
'vvf',
));
$this
->resetAll();
}
public function testFieldVariable() {
$view = $this
->getBasicView();
// Set random variable name and value.
$variable = $this
->randomName();
$value = $this
->randomName();
variable_set($variable, $value);
variable_set('variable_name', $variable);
$view->display['default']->handler
->override_option('fields', array(
'variable' => array(
'id' => 'variable',
'table' => 'views',
'field' => 'variable',
'relationship' => 'none',
'variable_name' => $variable,
),
'variable_name' => array(
'id' => 'variable_1',
'table' => 'views',
'field' => 'variable',
'relationship' => 'none',
'variable_name' => 'variable_name',
),
'variable_placeholder' => array(
'id' => 'variable_2',
'table' => 'views',
'field' => 'variable',
'relationship' => 'none',
'variable_name' => '[variable_name]',
),
));
$this
->executeView($view);
$this
->assertEqual($value, $view->style_plugin
->get_field(0, 'variable'));
$this
->assertEqual($variable, $view->style_plugin
->get_field(0, 'variable_name'));
$this
->assertEqual($value, $view->style_plugin
->get_field(0, 'variable_placeholder'));
}
}
Classes
Name | Description |
---|---|
ViewsHandlerFieldVariableTest | Tests the vvf views_handler_field_variable handler. |