updated contrib modules
This commit is contained in:
@@ -22,7 +22,7 @@ class ViewsHandlerAreaTextTest extends ViewsSqlTest {
|
||||
public function testAreaText() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// add a text header
|
||||
// add a text header.
|
||||
$string = $this->randomName();
|
||||
$view->display['default']->handler->override_option('header', array(
|
||||
'area' => array(
|
||||
|
@@ -25,7 +25,7 @@ class ViewsHandlerArgumentNullTest extends ViewsSqlTest {
|
||||
}
|
||||
|
||||
public function testAreaText() {
|
||||
// Test validation
|
||||
// Test validation.
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Add a null argument.
|
||||
|
@@ -53,6 +53,7 @@ class ViewsHandlerArgumentStringTest extends ViewsSqlTest {
|
||||
* Provide a test view for testGlossary.
|
||||
*
|
||||
* @see testGlossary
|
||||
*
|
||||
* @return view
|
||||
*/
|
||||
function viewGlossary() {
|
||||
@@ -93,4 +94,5 @@ class ViewsHandlerArgumentStringTest extends ViewsSqlTest {
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,11 +6,15 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests the generic field handler
|
||||
* Tests the generic field handler.
|
||||
*
|
||||
* @see views_handler_field
|
||||
*/
|
||||
class ViewsHandlerFieldTest extends ViewsSqlTest {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Field',
|
||||
@@ -19,6 +23,9 @@ class ViewsHandlerFieldTest extends ViewsSqlTest {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->column_map = array(
|
||||
@@ -26,17 +33,12 @@ class ViewsHandlerFieldTest extends ViewsSqlTest {
|
||||
);
|
||||
}
|
||||
|
||||
function testEmpty() {
|
||||
$this->_testHideIfEmpty();
|
||||
$this->_testEmptyText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the hide if empty functionality.
|
||||
*
|
||||
* This tests alters the result to get easier and less coupled results.
|
||||
*/
|
||||
function _testHideIfEmpty() {
|
||||
public function testHideIfEmpty() {
|
||||
$view = $this->getBasicView();
|
||||
$view->init_display();
|
||||
$this->executeView($view);
|
||||
@@ -139,7 +141,8 @@ class ViewsHandlerFieldTest extends ViewsSqlTest {
|
||||
$render = $view->field['name']->advanced_render($view->result[0]);
|
||||
$this->assertIdentical($render, $random_name, 'If the rewritten string is not empty, "0" should not be treated as empty.');
|
||||
|
||||
// Test when results are rewritten to an empty string and non-zero empty results are hidden.
|
||||
// Test when results are rewritten to an empty string and non-zero empty
|
||||
// results are hidden.
|
||||
$view->field['name']->options['hide_alter_empty'] = TRUE;
|
||||
$view->field['name']->options['hide_empty'] = TRUE;
|
||||
$view->field['name']->options['empty_zero'] = FALSE;
|
||||
@@ -254,7 +257,7 @@ class ViewsHandlerFieldTest extends ViewsSqlTest {
|
||||
/**
|
||||
* Tests the usage of the empty text.
|
||||
*/
|
||||
function _testEmptyText() {
|
||||
public function testEmptyText() {
|
||||
$view = $this->getBasicView();
|
||||
$view->init_display();
|
||||
$this->executeView($view);
|
||||
@@ -291,7 +294,7 @@ class ViewsHandlerFieldTest extends ViewsSqlTest {
|
||||
/**
|
||||
* Tests views_handler_field::is_value_empty().
|
||||
*/
|
||||
function testIsValueEmpty() {
|
||||
public function testIsValueEmpty() {
|
||||
$view = $this->getBasicView();
|
||||
$view->init_display();
|
||||
$view->init_handlers();
|
||||
|
@@ -18,7 +18,7 @@ class ViewsHandlerFieldBooleanTest extends ViewsSqlTest {
|
||||
}
|
||||
|
||||
function dataSet() {
|
||||
// Use default dataset but remove the age from john and paul
|
||||
// Use default dataset but remove the age from john and paul.
|
||||
$data = parent::dataSet();
|
||||
$data[0]['age'] = 0;
|
||||
$data[3]['age'] = 0;
|
||||
@@ -105,4 +105,5 @@ class ViewsHandlerFieldBooleanTest extends ViewsSqlTest {
|
||||
$this->assertNotEqual($values['false'], $view->field['age']->advanced_render($view->result[0]));
|
||||
$this->assertNotEqual($values['true'], $view->field['age']->advanced_render($view->result[1]));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ class ViewsHandlerFilterCounterTest extends ViewsSqlTest {
|
||||
'table' => 'views',
|
||||
'field' => 'counter',
|
||||
'relationship' => 'none',
|
||||
'counter_start' => $rand_start
|
||||
'counter_start' => $rand_start,
|
||||
),
|
||||
'name' => array(
|
||||
'id' => 'name',
|
||||
@@ -64,7 +64,8 @@ class ViewsHandlerFilterCounterTest extends ViewsSqlTest {
|
||||
$this->assertEqual(2 + $rand_start, $view->style_plugin->rendered_fields[2]['counter']);
|
||||
}
|
||||
|
||||
// @TODO: Write tests for pager.
|
||||
// @todo Write tests for pager.
|
||||
function testPager() {
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -44,4 +44,5 @@ class ViewsHandlerFieldCustomTest extends ViewsSqlTest {
|
||||
|
||||
$this->assertEqual($random, $view->style_plugin->get_field(0, 'name'));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -9,6 +9,10 @@
|
||||
* Tests the core views_handler_field_date handler.
|
||||
*/
|
||||
class ViewsHandlerFieldDateTest extends ViewsSqlTest {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Field: Date',
|
||||
@@ -17,12 +21,18 @@ class ViewsHandlerFieldDateTest extends ViewsSqlTest {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function viewsData() {
|
||||
$data = parent::viewsData();
|
||||
$data['views_test']['created']['field']['handler'] = 'views_handler_field_date';
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function testFieldDate() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
@@ -32,7 +42,8 @@ class ViewsHandlerFieldDateTest extends ViewsSqlTest {
|
||||
'table' => 'views_test',
|
||||
'field' => 'created',
|
||||
'relationship' => 'none',
|
||||
// c is iso 8601 date format @see http://php.net/manual/en/function.date.php
|
||||
// c is iso 8601 date format.
|
||||
// @see http://php.net/manual/en/function.date.php
|
||||
'custom_date_format' => 'c',
|
||||
'second_date_format' => 'custom',
|
||||
'second_date_format_custom' => 'c',
|
||||
@@ -62,13 +73,17 @@ class ViewsHandlerFieldDateTest extends ViewsSqlTest {
|
||||
$intervals = array(
|
||||
'raw time ago' => format_interval(REQUEST_TIME - $time, 2),
|
||||
'time ago' => t('%time ago', array('%time' => format_interval(REQUEST_TIME - $time, 2))),
|
||||
// TODO write tests for them
|
||||
// 'raw time span' => format_interval(REQUEST_TIME - $time, 2),
|
||||
// 'time span' => t('%time hence', array('%time' => format_interval(REQUEST_TIME - $time, 2))),
|
||||
// @todo write tests for them
|
||||
// 'raw time span' => format_interval(REQUEST_TIME - $time, 2),
|
||||
// 'time span' => t('%time hence',
|
||||
// array('%time' => format_interval(REQUEST_TIME - $time, 2))),
|
||||
);
|
||||
$this->assertRenderedDatesEqual($view, $intervals);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function assertRenderedDatesEqual($view, $map, $timezone = NULL) {
|
||||
foreach ($map as $date_format => $expected_result) {
|
||||
$check_result_number = 0;
|
||||
@@ -114,4 +129,5 @@ class ViewsHandlerFieldDateTest extends ViewsSqlTest {
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -63,4 +63,5 @@ class ViewsHandlerFileExtensionTest extends ViewsSqlTest {
|
||||
$this->assertEqual($view->field['name']->advanced_render($view->result[2]), 'tar.gz');
|
||||
$this->assertEqual($view->field['name']->advanced_render($view->result[3]), '');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -61,4 +61,5 @@ class ViewsHandlerTestFileSize extends ViewsSqlTest {
|
||||
$this->assertEqual($view->field['age']->advanced_render($view->result[2]), 1000);
|
||||
$this->assertEqual($view->field['age']->advanced_render($view->result[3]), 10000);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -42,4 +42,5 @@ class ViewsHandlerFieldMath extends ViewsSqlTest {
|
||||
|
||||
$this->assertEqual($rand1 + $rand2, $view->style_plugin->get_field(0, 'expression'));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -57,4 +57,5 @@ class ViewsHandlerFieldUrlTest extends ViewsSqlTest {
|
||||
|
||||
$this->assertEqual(l('John', 'John'), $view->field['name']->advanced_render($view->result[0]));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ class ViewsHandlerTestXss extends ViewsSqlTest {
|
||||
$map = array(
|
||||
'John' => 'John',
|
||||
"Foo\xC0barbaz" => '',
|
||||
'Fooÿñ' => 'Fooÿñ'
|
||||
'Fooÿñ' => 'Fooÿñ',
|
||||
);
|
||||
|
||||
return $map;
|
||||
@@ -57,4 +57,5 @@ class ViewsHandlerTestXss extends ViewsSqlTest {
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -102,4 +102,5 @@ class ViewsHandlerFilterCombineTest extends ViewsSqlTest {
|
||||
unset($schema['views_test']['fields']['job']['not null']);
|
||||
return $schema;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -168,7 +168,7 @@ class ViewsHandlerFilterDateTest extends ViewsSqlTest {
|
||||
$view = $this->views_test_between();
|
||||
$view->save();
|
||||
|
||||
$admin_user = $this->drupalCreateUser(array('administer views', 'administer site configuration'));
|
||||
$admin_user = $this->drupalCreateUser(array('administer views', 'administer site configuration'));
|
||||
$this->drupalLogin($admin_user);
|
||||
menu_rebuild();
|
||||
$this->drupalGet('admin/structure/views/view/test_filter_date_between/edit');
|
||||
@@ -182,7 +182,7 @@ class ViewsHandlerFilterDateTest extends ViewsSqlTest {
|
||||
}
|
||||
|
||||
function views_test_between() {
|
||||
$view = new view;
|
||||
$view = new view();
|
||||
$view->name = 'test_filter_date_between';
|
||||
$view->description = '';
|
||||
$view->tag = '';
|
||||
@@ -218,4 +218,5 @@ class ViewsHandlerFilterDateTest extends ViewsSqlTest {
|
||||
$view = $this->views_test_between();
|
||||
return $view;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ class ViewsHandlerFilterEqualityTest extends ViewsSqlTest {
|
||||
function testEqual() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'name' => array(
|
||||
'id' => 'name',
|
||||
@@ -59,7 +59,7 @@ class ViewsHandlerFilterEqualityTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Name, Operator: =, Value: Ringo
|
||||
// Filter: Name, Operator: =, Value: Ringo.
|
||||
$filters['name']['group_info']['default_group'] = 1;
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
@@ -76,7 +76,7 @@ class ViewsHandlerFilterEqualityTest extends ViewsSqlTest {
|
||||
function testNotEqual() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'name' => array(
|
||||
'id' => 'name',
|
||||
@@ -110,7 +110,7 @@ class ViewsHandlerFilterEqualityTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Name, Operator: !=, Value: Ringo
|
||||
// Filter: Name, Operator: !=, Value: Ringo.
|
||||
$filters['name']['group_info']['default_group'] = 2;
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
|
@@ -38,7 +38,7 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
|
||||
public function testFilterNumericSimple() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'age' => array(
|
||||
'id' => 'age',
|
||||
@@ -82,7 +82,7 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
|
||||
public function testFilterNumericBetween() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'age' => array(
|
||||
'id' => 'age',
|
||||
@@ -114,11 +114,11 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
|
||||
);
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
|
||||
|
||||
// test not between
|
||||
// test not between.
|
||||
$view->delete();
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'age' => array(
|
||||
'id' => 'age',
|
||||
@@ -160,7 +160,6 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
|
||||
|
||||
$this->executeView($view);
|
||||
$resultset = array(
|
||||
array(
|
||||
@@ -188,7 +187,6 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
|
||||
|
||||
$this->executeView($view);
|
||||
$resultset = array(
|
||||
array(
|
||||
@@ -211,7 +209,7 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
|
||||
public function testFilterNumericEmpty() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'age' => array(
|
||||
'id' => 'age',
|
||||
@@ -223,14 +221,13 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
|
||||
));
|
||||
|
||||
$this->executeView($view);
|
||||
$resultset = array(
|
||||
);
|
||||
$resultset = array();
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
|
||||
|
||||
$view->delete();
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'age' => array(
|
||||
'id' => 'age',
|
||||
@@ -243,7 +240,7 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
|
||||
|
||||
$this->executeView($view);
|
||||
$resultset = array(
|
||||
array(
|
||||
array(
|
||||
'name' => 'John',
|
||||
'age' => 25,
|
||||
),
|
||||
@@ -272,15 +269,13 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Age, Operator: empty, Value:
|
||||
// Filter: Age, Operator: empty, Value.
|
||||
$filters['age']['group_info']['default_group'] = 4;
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
|
||||
|
||||
$this->executeView($view);
|
||||
$resultset = array(
|
||||
);
|
||||
$resultset = array();
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
|
||||
}
|
||||
|
||||
@@ -288,15 +283,14 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Age, Operator: empty, Value:
|
||||
// Filter: Age, Operator: empty, Value.
|
||||
$filters['age']['group_info']['default_group'] = 5;
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
|
||||
|
||||
$this->executeView($view);
|
||||
$resultset = array(
|
||||
array(
|
||||
array(
|
||||
'name' => 'John',
|
||||
'age' => 25,
|
||||
),
|
||||
@@ -320,6 +314,38 @@ class ViewsHandlerFilterNumericTest extends ViewsSqlTest {
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the limit operators functionality.
|
||||
*/
|
||||
public function testFilterNumericExposedLimitOperators() {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicView();
|
||||
|
||||
$available_operators = array('<', '>', 'between');
|
||||
|
||||
$filters['age']['expose'] += array(
|
||||
'limit_operators' => TRUE,
|
||||
'available_operators' => drupal_map_assoc($available_operators),
|
||||
);
|
||||
|
||||
$view->display['default']->handler->override_option('filters', $filters);
|
||||
|
||||
|
||||
$this->executeView($view);
|
||||
|
||||
$form = array();
|
||||
$form_state = array();
|
||||
$view->filter['age']->operator_form($form, $form_state);
|
||||
|
||||
$operator = $form['operator'];
|
||||
|
||||
$this->assertTrue(in_array($operator['#default_value'], $available_operators), 'Default value operator found in list of available operators.');
|
||||
|
||||
foreach ($available_operators as $available_operator) {
|
||||
$this->assertTrue($operator['#options'][$available_operator], format_string('@operator found in options', array('@operator' => $available_operator)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function testAllowEmpty() {
|
||||
$view = $this->getBasicView();
|
||||
|
@@ -75,7 +75,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
function testFilterStringEqual() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'name' => array(
|
||||
'id' => 'name',
|
||||
@@ -100,7 +100,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Name, Operator: =, Value: Ringo
|
||||
// Filter: Name, Operator: =, Value: Ringo.
|
||||
$filters['name']['group_info']['default_group'] = 1;
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
@@ -119,7 +119,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
function testFilterStringNotEqual() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'name' => array(
|
||||
'id' => 'name',
|
||||
@@ -153,7 +153,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Name, Operator: !=, Value: Ringo
|
||||
// Filter: Name, Operator: !=, Value: Ringo.
|
||||
$filters['name']['group_info']['default_group'] = '2';
|
||||
|
||||
$view->set_display('page_1');
|
||||
@@ -182,7 +182,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
function testFilterStringContains() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'name' => array(
|
||||
'id' => 'name',
|
||||
@@ -208,7 +208,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Name, Operator: contains, Value: ing
|
||||
// Filter: Name, Operator: contains, Value: ing.
|
||||
$filters['name']['group_info']['default_group'] = '3';
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
@@ -228,7 +228,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
function testFilterStringWord() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'description' => array(
|
||||
'id' => 'description',
|
||||
@@ -254,7 +254,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'description' => array(
|
||||
'id' => 'description',
|
||||
@@ -277,10 +277,10 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
|
||||
|
||||
function testFilterStringGroupedExposedWord() {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Name, Operator: contains, Value: ing
|
||||
// Filter: Name, Operator: contains, Value: ing.
|
||||
$filters['name']['group_info']['default_group'] = '3';
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
@@ -299,7 +299,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Description, Operator: contains, Value: actor
|
||||
// Filter: Description, Operator: contains, Value: actor.
|
||||
$filters['description']['group_info']['default_group'] = '1';
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
@@ -319,7 +319,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
function testFilterStringStarts() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'description' => array(
|
||||
'id' => 'description',
|
||||
@@ -344,7 +344,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Name, Operator: starts, Value: George
|
||||
// Filter: Name, Operator: starts, Value: George.
|
||||
$filters['description']['group_info']['default_group'] = 2;
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
@@ -362,7 +362,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
function testFilterStringNotStarts() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'description' => array(
|
||||
'id' => 'description',
|
||||
@@ -385,7 +385,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
array(
|
||||
'name' => 'Paul',
|
||||
),
|
||||
// There is no Meredith returned because his description is empty
|
||||
// There is no Meredith returned because his description is empty.
|
||||
);
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
|
||||
}
|
||||
@@ -394,7 +394,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Name, Operator: not_starts, Value: George
|
||||
// Filter: Name, Operator: not_starts, Value: George.
|
||||
$filters['description']['group_info']['default_group'] = 3;
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
@@ -411,7 +411,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
array(
|
||||
'name' => 'Paul',
|
||||
),
|
||||
// There is no Meredith returned because his description is empty
|
||||
// There is no Meredith returned because his description is empty.
|
||||
);
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
|
||||
}
|
||||
@@ -419,7 +419,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
function testFilterStringEnds() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'description' => array(
|
||||
'id' => 'description',
|
||||
@@ -447,7 +447,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Descriptino, Operator: ends, Value: Beatles
|
||||
// Filter: Descriptino, Operator: ends, Value: Beatles.
|
||||
$filters['description']['group_info']['default_group'] = 4;
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
@@ -468,7 +468,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
function testFilterStringNotEnds() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'description' => array(
|
||||
'id' => 'description',
|
||||
@@ -488,7 +488,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
array(
|
||||
'name' => 'Paul',
|
||||
),
|
||||
// There is no Meredith returned because his description is empty
|
||||
// There is no Meredith returned because his description is empty.
|
||||
);
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
|
||||
}
|
||||
@@ -497,7 +497,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Description, Operator: not_ends, Value: Beatles
|
||||
// Filter: Description, Operator: not_ends, Value: Beatles.
|
||||
$filters['description']['group_info']['default_group'] = 5;
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
@@ -511,7 +511,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
array(
|
||||
'name' => 'Paul',
|
||||
),
|
||||
// There is no Meredith returned because his description is empty
|
||||
// There is no Meredith returned because his description is empty.
|
||||
);
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
|
||||
}
|
||||
@@ -519,7 +519,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
function testFilterStringNot() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'description' => array(
|
||||
'id' => 'description',
|
||||
@@ -539,7 +539,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
array(
|
||||
'name' => 'Paul',
|
||||
),
|
||||
// There is no Meredith returned because his description is empty
|
||||
// There is no Meredith returned because his description is empty.
|
||||
);
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
|
||||
}
|
||||
@@ -549,7 +549,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Description, Operator: not (does not contains), Value: Beatles
|
||||
// Filter: Description, Operator: not (does not contains), Value: Beatles.
|
||||
$filters['description']['group_info']['default_group'] = 6;
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
@@ -563,7 +563,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
array(
|
||||
'name' => 'Paul',
|
||||
),
|
||||
// There is no Meredith returned because his description is empty
|
||||
// There is no Meredith returned because his description is empty.
|
||||
);
|
||||
$this->assertIdenticalResultset($view, $resultset, $this->column_map);
|
||||
|
||||
@@ -572,7 +572,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
function testFilterStringShorter() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'name' => array(
|
||||
'id' => 'name',
|
||||
@@ -620,7 +620,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
function testFilterStringLonger() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'name' => array(
|
||||
'id' => 'name',
|
||||
@@ -663,7 +663,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
function testFilterStringEmpty() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the filtering
|
||||
// Change the filtering.
|
||||
$view->display['default']->handler->override_option('filters', array(
|
||||
'description' => array(
|
||||
'id' => 'description',
|
||||
@@ -687,7 +687,7 @@ class ViewsHandlerFilterStringTest extends ViewsSqlTest {
|
||||
$filters = $this->getGroupedExposedFilters();
|
||||
$view = $this->getBasicPageView();
|
||||
|
||||
// Filter: Description, Operator: empty, Value:
|
||||
// Filter: Description, Operator: empty, Value.
|
||||
$filters['description']['group_info']['default_group'] = 7;
|
||||
$view->set_display('page_1');
|
||||
$view->display['page_1']->handler->override_option('filters', $filters);
|
||||
|
1099
sites/all/modules/views/tests/handlers/views_handler_manytoone.test
Normal file
1099
sites/all/modules/views/tests/handlers/views_handler_manytoone.test
Normal file
File diff suppressed because it is too large
Load Diff
@@ -23,7 +23,7 @@ class ViewsHandlerSortTest extends ViewsSqlTest {
|
||||
public function testNumericOrdering() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the ordering
|
||||
// Change the ordering.
|
||||
$view->display['default']->handler->override_option('sorts', array(
|
||||
'age' => array(
|
||||
'order' => 'ASC',
|
||||
@@ -46,7 +46,7 @@ class ViewsHandlerSortTest extends ViewsSqlTest {
|
||||
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Reverse the ordering
|
||||
// Reverse the ordering.
|
||||
$view->display['default']->handler->override_option('sorts', array(
|
||||
'age' => array(
|
||||
'order' => 'DESC',
|
||||
@@ -74,7 +74,7 @@ class ViewsHandlerSortTest extends ViewsSqlTest {
|
||||
public function testStringOrdering() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Change the ordering
|
||||
// Change the ordering.
|
||||
$view->display['default']->handler->override_option('sorts', array(
|
||||
'name' => array(
|
||||
'order' => 'ASC',
|
||||
@@ -97,7 +97,7 @@ class ViewsHandlerSortTest extends ViewsSqlTest {
|
||||
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// Reverse the ordering
|
||||
// Reverse the ordering.
|
||||
$view->display['default']->handler->override_option('sorts', array(
|
||||
'name' => array(
|
||||
'order' => 'DESC',
|
||||
@@ -118,4 +118,5 @@ class ViewsHandlerSortTest extends ViewsSqlTest {
|
||||
'views_test_age' => 'age',
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -21,61 +21,66 @@ class ViewsHandlerSortDateTest extends ViewsSqlTest {
|
||||
$expected = array();
|
||||
if (!$reverse) {
|
||||
switch ($granularity) {
|
||||
case 'second':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
array('name' => 'Paul'),
|
||||
array('name' => 'Meredith'),
|
||||
array('name' => 'Ringo'),
|
||||
array('name' => 'George'),
|
||||
);
|
||||
break;
|
||||
case 'minute':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
array('name' => 'Paul'),
|
||||
array('name' => 'Ringo'),
|
||||
array('name' => 'Meredith'),
|
||||
array('name' => 'George'),
|
||||
);
|
||||
break;
|
||||
case 'hour':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
array('name' => 'Ringo'),
|
||||
array('name' => 'Paul'),
|
||||
array('name' => 'Meredith'),
|
||||
array('name' => 'George'),
|
||||
);
|
||||
break;
|
||||
case 'day':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
array('name' => 'Ringo'),
|
||||
array('name' => 'Paul'),
|
||||
array('name' => 'Meredith'),
|
||||
array('name' => 'George'),
|
||||
);
|
||||
break;
|
||||
case 'month':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
array('name' => 'George'),
|
||||
array('name' => 'Ringo'),
|
||||
array('name' => 'Paul'),
|
||||
array('name' => 'Meredith'),
|
||||
);
|
||||
break;
|
||||
case 'year':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
array('name' => 'George'),
|
||||
array('name' => 'Ringo'),
|
||||
array('name' => 'Paul'),
|
||||
array('name' => 'Meredith'),
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 'second':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
array('name' => 'Paul'),
|
||||
array('name' => 'Meredith'),
|
||||
array('name' => 'Ringo'),
|
||||
array('name' => 'George'),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'minute':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
array('name' => 'Paul'),
|
||||
array('name' => 'Ringo'),
|
||||
array('name' => 'Meredith'),
|
||||
array('name' => 'George'),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'hour':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
array('name' => 'Ringo'),
|
||||
array('name' => 'Paul'),
|
||||
array('name' => 'Meredith'),
|
||||
array('name' => 'George'),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'day':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
array('name' => 'Ringo'),
|
||||
array('name' => 'Paul'),
|
||||
array('name' => 'Meredith'),
|
||||
array('name' => 'George'),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'month':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
array('name' => 'George'),
|
||||
array('name' => 'Ringo'),
|
||||
array('name' => 'Paul'),
|
||||
array('name' => 'Meredith'),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'year':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
array('name' => 'George'),
|
||||
array('name' => 'Ringo'),
|
||||
array('name' => 'Paul'),
|
||||
array('name' => 'Meredith'),
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ($granularity) {
|
||||
@@ -88,6 +93,7 @@ class ViewsHandlerSortDateTest extends ViewsSqlTest {
|
||||
array('name' => 'John'),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'minute':
|
||||
$expected = array(
|
||||
array('name' => 'George'),
|
||||
@@ -95,8 +101,9 @@ class ViewsHandlerSortDateTest extends ViewsSqlTest {
|
||||
array('name' => 'Meredith'),
|
||||
array('name' => 'Paul'),
|
||||
array('name' => 'John'),
|
||||
);
|
||||
);
|
||||
break;
|
||||
|
||||
case 'hour':
|
||||
$expected = array(
|
||||
array('name' => 'George'),
|
||||
@@ -106,6 +113,7 @@ class ViewsHandlerSortDateTest extends ViewsSqlTest {
|
||||
array('name' => 'John'),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'day':
|
||||
$expected = array(
|
||||
array('name' => 'George'),
|
||||
@@ -115,6 +123,7 @@ class ViewsHandlerSortDateTest extends ViewsSqlTest {
|
||||
array('name' => 'Meredith'),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'month':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
@@ -124,6 +133,7 @@ class ViewsHandlerSortDateTest extends ViewsSqlTest {
|
||||
array('name' => 'Meredith'),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'year':
|
||||
$expected = array(
|
||||
array('name' => 'John'),
|
||||
@@ -163,7 +173,7 @@ class ViewsHandlerSortDateTest extends ViewsSqlTest {
|
||||
),
|
||||
));
|
||||
|
||||
// Change the ordering
|
||||
// Change the ordering.
|
||||
$view->display['default']->handler->override_option('sorts', array(
|
||||
'created' => array(
|
||||
'id' => 'created',
|
||||
@@ -195,4 +205,5 @@ class ViewsHandlerSortDateTest extends ViewsSqlTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -9,6 +9,10 @@
|
||||
* Tests for core views_handler_sort_random handler.
|
||||
*/
|
||||
class ViewsHandlerSortRandomTest extends ViewsSqlTest {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Sort: random',
|
||||
@@ -77,7 +81,8 @@ class ViewsHandlerSortRandomTest extends ViewsSqlTest {
|
||||
'views_test_age' => 'views_test_name',
|
||||
));
|
||||
|
||||
// Execute a second random view, we expect the result set to be different again.
|
||||
// Execute a second random view, we expect the result set to be different
|
||||
// again.
|
||||
$view_random_2 = $this->getBasicRandomView();
|
||||
$this->executeView($view_random_2);
|
||||
$this->assertEqual(count($this->dataSet()), count($view_random_2->result), t('The number of returned rows match.'));
|
||||
@@ -86,4 +91,5 @@ class ViewsHandlerSortRandomTest extends ViewsSqlTest {
|
||||
'views_test_age' => 'views_test_name',
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains ViewsHandlerTest.
|
||||
* Definition of ViewsHandlerTest.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ class ViewsHandlerTest extends ViewsSqlTest {
|
||||
public function testHandlerAccess() {
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// add a test area
|
||||
// add a test area.
|
||||
$view->display['default']->handler->override_option('header', array(
|
||||
'test_access' => array(
|
||||
'id' => 'test_access',
|
||||
@@ -61,7 +61,7 @@ class ViewsHandlerTest extends ViewsSqlTest {
|
||||
|
||||
$view = $this->getBasicView();
|
||||
|
||||
// add a test area
|
||||
// add a test area.
|
||||
$view->display['default']->handler->override_option('header', array(
|
||||
'test_access' => array(
|
||||
'id' => 'test_access',
|
||||
|
Reference in New Issue
Block a user