View source
<?php
class ViewsHandlerManyToOneTest extends ViewsSqlTest {
protected $fields;
protected $instances;
protected $nodes;
protected $accounts;
protected $terms;
public static function getInfo() {
return array(
'name' => 'Handler: Many To One Helper',
'description' => 'Tests the many to one helper handler',
'group' => 'Views Handlers',
);
}
protected function clearViewsDataCache() {
drupal_static_reset('_views_fetch_data_cache');
drupal_static_reset('_views_fetch_data_recursion_protected');
drupal_static_reset('_views_fetch_data_fully_loaded');
}
protected function createTerm($vocabulary) {
$term = new stdClass();
$term->name = $this
->randomName();
$term->description = $this
->randomName();
$term->format = db_query_range('SELECT format FROM {filter_format}', 0, 1)
->fetchField();
$term->vid = $vocabulary->vid;
taxonomy_term_save($term);
return $term;
}
public function setUp(array $modules = array()) {
parent::setUp($modules);
$this->fields[0] = array(
'field_name' => 'field_bool',
'type' => 'list_boolean',
'cardinality' => 1,
'settings' => array(
'allowed_values' => array(
0 => '',
1 => '',
),
),
);
$this->fields[0] = field_create_field($this->fields[0]);
$this->fields[1] = array(
'field_name' => 'field_list',
'type' => 'list_text',
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
'settings' => array(
'allowed_values' => array(
1 => '1',
2 => '2',
3 => '3',
),
),
);
$this->fields[1] = field_create_field($this->fields[1]);
$instance = array(
'field_name' => $this->fields[0]['field_name'],
'entity_type' => 'node',
'bundle' => 'article',
'widget' => array(
'type' => 'options_onoff',
),
);
$this->instances[0][] = field_create_instance($instance);
$instance = array(
'field_name' => $this->fields[1]['field_name'],
'entity_type' => 'node',
'bundle' => 'article',
'widget' => array(
'type' => 'options_buttons',
),
);
$this->instances[1][] = field_create_instance($instance);
$instance = array(
'field_name' => $this->fields[0]['field_name'],
'entity_type' => 'user',
'bundle' => 'user',
'widget' => array(
'type' => 'options_onoff',
),
);
$this->instances[0][] = field_create_instance($instance);
$instance = array(
'field_name' => $this->fields[1]['field_name'],
'entity_type' => 'user',
'bundle' => 'user',
'widget' => array(
'type' => 'options_buttons',
),
);
$this->instances[1][] = field_create_instance($instance);
$instance = array(
'field_name' => 'field_tags',
'entity_type' => 'user',
'bundle' => 'user',
);
$this->instances[2][] = field_create_instance($instance);
$this
->clearViewsDataCache();
$vocabulary = taxonomy_vocabulary_machine_name_load('tags');
for ($i = 0; $i < 62; $i++) {
$this->terms[] = $this
->createTerm($vocabulary);
}
$node = array();
$node['type'] = 'article';
$node[$this->fields[0]['field_name']][LANGUAGE_NONE][]['value'] = '1';
$node[$this->fields[1]['field_name']][LANGUAGE_NONE][]['value'] = '1';
$node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->terms[1]->tid;
$this->nodes[0] = $this
->drupalCreateNode($node);
$node = array();
$node['type'] = 'article';
$node[$this->fields[0]['field_name']] = array();
$node[$this->fields[1]['field_name']] = array();
$node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->terms[0]->tid;
$this->nodes[1] = $this
->drupalCreateNode($node);
$node = array();
$node['type'] = 'article';
$node[$this->fields[0]['field_name']] = array();
$node[$this->fields[1]['field_name']] = array();
$node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->terms[0]->tid;
$node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->terms[1]->tid;
$this->nodes[2] = $this
->drupalCreateNode($node);
$permissions = array(
'access content',
);
$account = $this
->drupalCreateUser($permissions);
$account->{$this->fields[0]['field_name']}[LANGUAGE_NONE][]['value'] = '1';
$account->{$this->fields[1]['field_name']}[LANGUAGE_NONE][]['value'] = '1';
$account->field_tags[LANGUAGE_NONE][]['tid'] = $this->terms[0]->tid;
$this->accounts[0] = user_save($account);
}
public function testJoinLimitNoneOf() {
$view = $this
->getJoinLimitNoneOfTestView();
$this
->executeView($view);
$value = field_get_items('node', $this->nodes[0], 'field_tags', LANGUAGE_NONE);
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
$this
->assertIdentical($value, 2, 'First node has been created and tags field references term 2.');
$value = field_get_items('node', $this->nodes[1], 'field_tags', LANGUAGE_NONE);
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
$this
->assertIdentical($value, 1, 'Second node has been created and tags field references term 1.');
$value = field_get_items('user', $this->accounts[0], 'field_tags', LANGUAGE_NONE);
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
$this
->assertIdentical($value, 1, 'User has been created and tags field references term 1.');
$this
->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node id of second node matches uid of first user.');
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$this
->assertEqual($result_count, 1, 'View has one result.');
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$this
->assertIdentical($nid, (int) $this->nodes[1]->nid, 'View result has correct node id.');
}
public function testGroupedNoneOf() {
$view = $this
->getGroupedNoneOfTestView();
$this
->executeView($view);
$value = field_get_items('node', $this->nodes[0], $this->fields[0]['field_name'], LANGUAGE_NONE);
$value = isset($value[0]['value']) ? (int) $value[0]['value'] : 0;
$this
->assertIdentical($value, 1, 'First node has been created and boolean field is checked.');
$value = field_get_items('node', $this->nodes[1], $this->fields[0]['field_name'], LANGUAGE_NONE);
$this
->assertFalse($value, 'Second node has been created and boolean field is not checked.');
$value = field_get_items('node', $this->nodes[2], $this->fields[0]['field_name'], LANGUAGE_NONE);
$this
->assertFalse($value, 'Third node has been created and boolean field is not checked.');
$value = field_get_items('user', $this->accounts[0], $this->fields[0]['field_name'], LANGUAGE_NONE);
$value = isset($value[0]['value']) ? (int) $value[0]['value'] : 0;
$this
->assertIdentical($value, 1, 'User has been created and boolean field is checked.');
$this
->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node ID of second node matches UID of first user.');
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$this
->assertEqual($result_count, 2, 'View has two results.');
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$result1 = $nid === (int) $this->nodes[1]->nid;
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
$result2 = $nid === (int) $this->nodes[2]->nid;
$this
->assertTrue($result1 && $result2, 'View result has correct node IDs.');
}
public function testGroupedOneOf() {
$view = $this
->getGroupedOneOfTestView();
$this
->executeView($view);
$value = field_get_items('node', $this->nodes[0], 'field_tags', LANGUAGE_NONE);
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
$this
->assertIdentical($value, 2, 'First node has been created and tags field references term 2.');
$value = field_get_items('node', $this->nodes[1], 'field_tags', LANGUAGE_NONE);
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
$this
->assertIdentical($value, 1, 'Second node has been created and tags field references term 1.');
$value = field_get_items('node', $this->nodes[2], 'field_tags', LANGUAGE_NONE);
$value = !empty($value[0]['tid']) && !empty($value[1]['tid']);
$this
->assertTrue($value, 'Third node has been created and tags field references both terms 1 and 2.');
$value = field_get_items('user', $this->accounts[0], 'field_tags', LANGUAGE_NONE);
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
$this
->assertIdentical($value, 1, 'User has been created and tags field references term 1.');
$this
->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node ID of second node matches UID of first user.');
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$this
->assertEqual($result_count, 2, 'View has two results.');
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$result1 = $nid === (int) $this->nodes[1]->nid;
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
$result2 = $nid === (int) $this->nodes[2]->nid;
$this
->assertTrue($result1 && $result2, 'View result has correct node IDs.');
}
public function testReducedExposedGroupedOptions() {
$value = field_get_items('node', $this->nodes[0], 'field_list', LANGUAGE_NONE);
$value = isset($value[0]['value']) ? (int) $value[0]['value'] : 0;
$this
->assertIdentical($value, 1, 'First node has been created and list field has value 1.');
$value = field_get_items('node', $this->nodes[1], 'field_list', LANGUAGE_NONE);
$this
->assertFalse($value, 'Second node has been created and list field is empty.');
$value = field_get_items('node', $this->nodes[2], 'field_list', LANGUAGE_NONE);
$this
->assertFalse($value, 'Third node has been created and list field is empty.');
$value = field_get_items('user', $this->accounts[0], 'field_list', LANGUAGE_NONE);
$value = isset($value[0]['value']) ? (int) $value[0]['value'] : 0;
$this
->assertIdentical($value, 1, 'User has been created and list field has value 1.');
$this
->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node ID of second node matches UID of first user.');
$view = $this
->getReducedExposedGroupedOptionsTestView();
$this
->executeView($view);
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$this
->assertEqual($result_count, 3, 'Default option: View has three results.');
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$result1 = $nid === (int) $this->nodes[0]->nid;
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
$result2 = $nid === (int) $this->nodes[1]->nid;
$nid = isset($view->result[2]->nid) ? (int) $view->result[2]->nid : 0;
$result3 = $nid === (int) $this->nodes[2]->nid;
$this
->assertTrue($result1 && $result2 && $result3, 'Default option: View result has correct node ID.');
$view = $this
->getReducedExposedGroupedOptionsTestView();
$view
->set_exposed_input(array(
'field_list_value' => '1',
));
$this
->executeView($view);
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$this
->assertEqual($result_count, 2, 'Option 1: View has two results.');
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$result1 = $nid === (int) $this->nodes[1]->nid;
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
$result2 = $nid === (int) $this->nodes[2]->nid;
$this
->assertTrue($result1 && $result2, 'Option 1: View result has correct node ID.');
$view = $this
->getReducedExposedGroupedOptionsTestView();
$view
->set_exposed_input(array(
'field_list_value' => '2',
));
$this
->executeView($view);
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$this
->assertEqual($result_count, 1, 'Option 2: View has one result.');
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$this
->assertIdentical($nid, (int) $this->nodes[0]->nid, 'Option 2: View result has correct node ID.');
$view = $this
->getReducedExposedGroupedOptionsTestView();
$view
->set_exposed_input(array(
'field_list_value' => '3',
));
$this
->executeView($view);
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$this
->assertEqual($result_count, 1, 'Option 3: View has one result.');
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$this
->assertIdentical($nid, (int) $this->nodes[0]->nid, 'Option 3: View result has correct node ID.');
$view = $this
->getReducedExposedGroupedOptionsTestView();
$view
->set_exposed_input(array(
'field_list_value' => '5',
));
$this
->executeView($view);
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$this
->assertEqual($result_count, 2, 'Option 5: View has two results.');
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$result1 = $nid === (int) $this->nodes[1]->nid;
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
$result2 = $nid === (int) $this->nodes[2]->nid;
$this
->assertTrue($result1 && $result2, 'Option 5: View result has correct node IDs.');
$view = $this
->getReducedExposedGroupedOptionsTestView();
$view
->set_exposed_input(array(
'field_list_value' => '6',
));
$this
->executeView($view);
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$this
->assertEqual($result_count, 1, 'Option 6: View has one result.');
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$this
->assertIdentical($nid, (int) $this->nodes[0]->nid, 'Option 6: View result has correct node ID.');
}
public function testTermIdExposedGroupedOptions() {
$value = field_get_items('node', $this->nodes[0], 'field_tags', LANGUAGE_NONE);
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
$this
->assertIdentical($value, 2, 'First node has been created and tags field references term 2.');
$value = field_get_items('node', $this->nodes[1], 'field_tags', LANGUAGE_NONE);
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
$this
->assertIdentical($value, 1, 'Second node has been created and tags field references term 1.');
$value = field_get_items('user', $this->accounts[0], 'field_tags', LANGUAGE_NONE);
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
$this
->assertIdentical($value, 1, 'User has been created and tags field references term 1.');
$this
->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node ID of second node matches UID of first user.');
$view = $this
->getTermIdExposedGroupedOptionsTestView();
$this
->executeView($view);
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$this
->assertEqual($result_count, 3, 'Default option: View has three results.');
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$result1 = $nid === (int) $this->nodes[0]->nid;
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
$result2 = $nid === (int) $this->nodes[1]->nid;
$nid = isset($view->result[2]->nid) ? (int) $view->result[2]->nid : 0;
$result3 = $nid === (int) $this->nodes[2]->nid;
$this
->assertTrue($result1 && $result2 && $result3, 'Default option: View result has correct node ID.');
$view = $this
->getTermIdExposedGroupedOptionsTestView();
$view
->set_exposed_input(array(
'field_tags_tid' => '1',
));
$this
->executeView($view);
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$this
->assertEqual($result_count, 1, 'Option 1: View has one result.');
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$this
->assertIdentical($nid, (int) $this->nodes[1]->nid, 'Option 1: View result has correct node ID.');
$view = $this
->getTermIdExposedGroupedOptionsTestView();
$view
->set_exposed_input(array(
'field_tags_tid' => '2',
));
$this
->executeView($view);
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 1;
$this
->assertEqual($result_count, 0, 'Option 2: View has empty result.');
$view = $this
->getTermIdExposedGroupedOptionsTestView();
$view
->set_exposed_input(array(
'field_tags_tid' => '3',
));
$this
->executeView($view);
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$this
->assertEqual($result_count, 2, 'Option 3: View has two results.');
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$result1 = $nid === (int) $this->nodes[1]->nid;
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
$result2 = $nid === (int) $this->nodes[2]->nid;
$this
->assertTrue($result1 && $result2, 'Option 3: View result has correct node ID.');
$view = $this
->getTermIdExposedGroupedOptionsTestView();
$view
->set_exposed_input(array(
'field_tags_tid' => '4',
));
$this
->executeView($view);
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$result1 = $nid === (int) $this->nodes[0]->nid;
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
$result2 = $nid === (int) $this->nodes[1]->nid;
$nid = isset($view->result[2]->nid) ? (int) $view->result[2]->nid : 0;
$result3 = $nid === (int) $this->nodes[2]->nid;
$nid = isset($view->result[3]->nid) ? (int) $view->result[3]->nid : 0;
$result4 = $nid === (int) $this->nodes[2]->nid;
$this
->assertTrue($result1 && $result2 && $result3 && $result4, 'Option 4: View result has correct node ID.');
$this
->verbose($view->result);
$this
->assertEqual($result_count, 4, 'Option 4: View has four results.');
$view = $this
->getTermIdExposedGroupedOptionsTestView();
$view
->set_exposed_input(array(
'field_tags_tid' => '6',
));
$this
->executeView($view);
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 1;
$this
->assertIdentical($result_count, 0, 'Option 6: View has empty result.');
$view = $this
->getTermIdExposedGroupedOptionsTestView();
$view
->set_exposed_input(array(
'field_tags_tid' => '7',
));
$this
->executeView($view);
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
$result1 = $nid === (int) $this->nodes[0]->nid;
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
$result2 = $nid === (int) $this->nodes[1]->nid;
$nid = isset($view->result[2]->nid) ? (int) $view->result[2]->nid : 0;
$result3 = $nid === (int) $this->nodes[2]->nid;
$nid = isset($view->result[3]->nid) ? (int) $view->result[3]->nid : 0;
$result4 = $nid === (int) $this->nodes[2]->nid;
$this
->assertTrue($result1 && $result2 && $result3 && $result4, 'Option 7: View result has correct node ID.');
$this
->verbose($view->result);
$this
->assertIdentical($result_count, 4, 'Option 7: View has four results.');
}
protected function getGroupedNoneOfTestView() {
$view = new view();
$view->name = 'test_not';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'test_not';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE;
$handler = $view
->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['sorts']['nid']['id'] = 'nid';
$handler->display->display_options['sorts']['nid']['table'] = 'node';
$handler->display->display_options['sorts']['nid']['field'] = 'nid';
$handler->display->display_options['filter_groups']['operator'] = 'OR';
$handler->display->display_options['filter_groups']['groups'] = array(
1 => 'AND',
2 => 'AND',
);
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'article' => 'article',
);
$handler->display->display_options['filters']['type']['group'] = 1;
$handler->display->display_options['filters']['field_bool_value']['id'] = 'field_bool_value';
$handler->display->display_options['filters']['field_bool_value']['table'] = 'field_data_field_bool';
$handler->display->display_options['filters']['field_bool_value']['field'] = 'field_bool_value';
$handler->display->display_options['filters']['field_bool_value']['operator'] = 'not';
$handler->display->display_options['filters']['field_bool_value']['value'] = array(
1 => '1',
);
$handler->display->display_options['filters']['field_bool_value']['group'] = 1;
$handler->display->display_options['filters']['field_bool_value_1']['id'] = 'field_bool_value_1';
$handler->display->display_options['filters']['field_bool_value_1']['table'] = 'field_data_field_bool';
$handler->display->display_options['filters']['field_bool_value_1']['field'] = 'field_bool_value';
$handler->display->display_options['filters']['field_bool_value_1']['operator'] = 'not';
$handler->display->display_options['filters']['field_bool_value_1']['value'] = array(
1 => '1',
);
$handler->display->display_options['filters']['field_bool_value_1']['group'] = 2;
$handler->display->display_options['filters']['type_1']['id'] = 'type_1';
$handler->display->display_options['filters']['type_1']['table'] = 'node';
$handler->display->display_options['filters']['type_1']['field'] = 'type';
$handler->display->display_options['filters']['type_1']['value'] = array(
'article' => 'article',
);
$handler->display->display_options['filters']['type_1']['group'] = 2;
$handler->display->display_options['filters']['status_1']['id'] = 'status_1';
$handler->display->display_options['filters']['status_1']['table'] = 'node';
$handler->display->display_options['filters']['status_1']['field'] = 'status';
$handler->display->display_options['filters']['status_1']['value'] = '1';
$handler->display->display_options['filters']['status_1']['group'] = 2;
return $view;
}
protected function getGroupedOneOfTestView() {
$view = new view();
$view->name = 'test_oneof';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'test_oneof';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE;
$handler = $view
->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['sorts']['nid']['id'] = 'nid';
$handler->display->display_options['sorts']['nid']['table'] = 'node';
$handler->display->display_options['sorts']['nid']['field'] = 'nid';
$handler->display->display_options['filter_groups']['operator'] = 'OR';
$handler->display->display_options['filter_groups']['groups'] = array(
1 => 'AND',
2 => 'AND',
);
$handler->display->display_options['filters']['field_tags_tid']['id'] = 'field_tags_tid';
$handler->display->display_options['filters']['field_tags_tid']['table'] = 'field_data_field_tags';
$handler->display->display_options['filters']['field_tags_tid']['field'] = 'field_tags_tid';
$handler->display->display_options['filters']['field_tags_tid']['value'] = array(
1 => '1',
);
$handler->display->display_options['filters']['field_tags_tid']['group'] = 2;
$handler->display->display_options['filters']['field_tags_tid']['reduce_duplicates'] = TRUE;
$handler->display->display_options['filters']['field_tags_tid']['type'] = 'select';
$handler->display->display_options['filters']['field_tags_tid']['vocabulary'] = 'tags';
$handler->display->display_options['filters']['field_tags_tid_1']['id'] = 'field_tags_tid_1';
$handler->display->display_options['filters']['field_tags_tid_1']['table'] = 'field_data_field_tags';
$handler->display->display_options['filters']['field_tags_tid_1']['field'] = 'field_tags_tid';
$handler->display->display_options['filters']['field_tags_tid_1']['value'] = array(
1 => '1',
);
$handler->display->display_options['filters']['field_tags_tid_1']['reduce_duplicates'] = TRUE;
$handler->display->display_options['filters']['field_tags_tid_1']['type'] = 'select';
$handler->display->display_options['filters']['field_tags_tid_1']['vocabulary'] = 'tags';
return $view;
}
protected function getReducedExposedGroupedOptionsTestView() {
$view = new view();
$view->name = 'test_reduced_exposed_grouped_options';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'test_reduced_exposed_grouped_options';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE;
$handler = $view
->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['sorts']['nid']['id'] = 'nid';
$handler->display->display_options['sorts']['nid']['table'] = 'node';
$handler->display->display_options['sorts']['nid']['field'] = 'nid';
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
$handler->display->display_options['filters']['field_list_value']['id'] = 'field_list_value';
$handler->display->display_options['filters']['field_list_value']['table'] = 'field_data_field_list';
$handler->display->display_options['filters']['field_list_value']['field'] = 'field_list_value';
$handler->display->display_options['filters']['field_list_value']['exposed'] = TRUE;
$handler->display->display_options['filters']['field_list_value']['expose']['operator_id'] = 'field_list_value_op';
$handler->display->display_options['filters']['field_list_value']['expose']['label'] = 'list (field_list)';
$handler->display->display_options['filters']['field_list_value']['expose']['operator'] = 'field_list_value_op';
$handler->display->display_options['filters']['field_list_value']['expose']['identifier'] = 'field_list_value';
$handler->display->display_options['filters']['field_list_value']['is_grouped'] = TRUE;
$handler->display->display_options['filters']['field_list_value']['group_info']['label'] = 'list (field_list)';
$handler->display->display_options['filters']['field_list_value']['group_info']['identifier'] = 'field_list_value';
$handler->display->display_options['filters']['field_list_value']['group_info']['group_items'] = array(
1 => array(
'title' => 'Not 1 or 2',
'operator' => 'not',
'value' => array(
1 => '1',
2 => '2',
),
),
2 => array(
'title' => '1',
'operator' => 'or',
'value' => array(
1 => '1',
),
),
3 => array(
'title' => '1 or 2',
'operator' => 'or',
'value' => array(
1 => '1',
2 => '2',
),
),
4 => array(
'title' => '1 and 2',
'operator' => 'and',
'value' => array(
1 => '1',
2 => '2',
),
),
5 => array(
'title' => 'empty',
'operator' => 'empty',
'value' => array(),
),
6 => array(
'title' => 'not empty',
'operator' => 'not empty',
'value' => array(),
),
);
return $view;
}
protected function getTermIdExposedGroupedOptionsTestView() {
$view = new view();
$view->name = 'test_tid_exposed_grouped_options';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'test_tid_exposed_grouped_options';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE;
$handler = $view
->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['sorts']['nid']['id'] = 'nid';
$handler->display->display_options['sorts']['nid']['table'] = 'node';
$handler->display->display_options['sorts']['nid']['field'] = 'nid';
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
$handler->display->display_options['filters']['field_tags_tid']['id'] = 'field_tags_tid';
$handler->display->display_options['filters']['field_tags_tid']['table'] = 'field_data_field_tags';
$handler->display->display_options['filters']['field_tags_tid']['field'] = 'field_tags_tid';
$handler->display->display_options['filters']['field_tags_tid']['value'] = array(
1 => '1',
2 => '2',
);
$handler->display->display_options['filters']['field_tags_tid']['exposed'] = TRUE;
$handler->display->display_options['filters']['field_tags_tid']['expose']['operator_id'] = 'field_tags_tid_op';
$handler->display->display_options['filters']['field_tags_tid']['expose']['label'] = 'Tags (field_tags)';
$handler->display->display_options['filters']['field_tags_tid']['expose']['operator'] = 'field_tags_tid_op';
$handler->display->display_options['filters']['field_tags_tid']['expose']['identifier'] = 'field_tags_tid';
$handler->display->display_options['filters']['field_tags_tid']['expose']['remember_roles'] = array(
2 => '2',
);
$handler->display->display_options['filters']['field_tags_tid']['is_grouped'] = TRUE;
$handler->display->display_options['filters']['field_tags_tid']['group_info']['label'] = 'Tags (field_tags)';
$handler->display->display_options['filters']['field_tags_tid']['group_info']['identifier'] = 'field_tags_tid';
$handler->display->display_options['filters']['field_tags_tid']['group_info']['group_items'] = array(
1 => array(
'title' => 'Is none of 2',
'operator' => 'not',
'value' => array(
2 => '2',
),
),
2 => array(
'title' => 'Is none of 1 or 2',
'operator' => 'not',
'value' => array(
1 => '1',
2 => '2',
),
),
3 => array(
'title' => 'Is one of 1',
'operator' => 'or',
'value' => array(
1 => '1',
),
),
4 => array(
'title' => 'Is one of 1 or 2',
'operator' => 'or',
'value' => array(
1 => '1',
2 => '2',
),
),
5 => array(
'title' => 'Is all of 1 and 2',
'operator' => 'and',
'value' => array(
1 => '1',
2 => '2',
),
),
6 => array(
'title' => 'Is empty',
'operator' => 'empty',
'value' => array(
1 => '1',
2 => '2',
),
),
7 => array(
'title' => 'Is not empty',
'operator' => 'not empty',
'value' => array(
1 => '1',
2 => '2',
),
),
);
$handler->display->display_options['filters']['field_tags_tid']['type'] = 'select';
$handler->display->display_options['filters']['field_tags_tid']['vocabulary'] = 'tags';
return $view;
}
protected function getJoinLimitNoneOfTestView() {
$view = new view();
$view->name = 'test_join_limit_none_of';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'test_join_limit_none_of';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE;
$handler = $view
->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
$handler->display->display_options['filters']['field_tags_tid']['id'] = 'field_tags_tid';
$handler->display->display_options['filters']['field_tags_tid']['table'] = 'field_data_field_tags';
$handler->display->display_options['filters']['field_tags_tid']['field'] = 'field_tags_tid';
$handler->display->display_options['filters']['field_tags_tid']['operator'] = 'not';
$handler->display->display_options['filters']['field_tags_tid']['value'] = array(
2 => '2',
3 => '3',
4 => '4',
5 => '5',
6 => '6',
7 => '7',
8 => '8',
9 => '9',
10 => '10',
11 => '11',
12 => '12',
13 => '13',
14 => '14',
15 => '15',
16 => '16',
17 => '17',
18 => '18',
19 => '19',
20 => '20',
21 => '21',
22 => '22',
23 => '23',
24 => '24',
25 => '25',
26 => '26',
27 => '27',
28 => '28',
29 => '29',
30 => '30',
31 => '31',
32 => '32',
33 => '33',
34 => '34',
35 => '35',
36 => '36',
37 => '37',
38 => '38',
39 => '39',
40 => '40',
41 => '41',
42 => '42',
43 => '43',
44 => '44',
45 => '45',
46 => '46',
47 => '47',
48 => '48',
49 => '49',
50 => '50',
51 => '51',
52 => '52',
53 => '53',
54 => '54',
55 => '55',
56 => '56',
57 => '57',
58 => '58',
59 => '59',
60 => '60',
61 => '61',
62 => '62',
63 => '63',
64 => '64',
65 => '65',
66 => '66',
67 => '67',
68 => '68',
69 => '69',
61 => '61',
62 => '62',
);
$handler->display->display_options['filters']['field_tags_tid']['type'] = 'select';
$handler->display->display_options['filters']['field_tags_tid']['vocabulary'] = 'tags';
return $view;
}
}