1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* Tests the many to one helper handler class.
|
5
|
*/
|
6
|
class ViewsHandlerManyToOneTest extends ViewsSqlTest {
|
7
|
|
8
|
/**
|
9
|
* Field definitions used by this test.
|
10
|
*
|
11
|
* @var array
|
12
|
*/
|
13
|
protected $fields;
|
14
|
|
15
|
/**
|
16
|
* Instances of fields used by this test.
|
17
|
*
|
18
|
* @var array
|
19
|
*/
|
20
|
protected $instances;
|
21
|
|
22
|
/**
|
23
|
* Nodes used by this test.
|
24
|
*
|
25
|
* @var object[]
|
26
|
*/
|
27
|
protected $nodes;
|
28
|
|
29
|
/**
|
30
|
* Accounts used by this test.
|
31
|
*
|
32
|
* @var object[]
|
33
|
*/
|
34
|
protected $accounts;
|
35
|
|
36
|
/**
|
37
|
* Terms used by this test.
|
38
|
*
|
39
|
* @var object[]
|
40
|
*/
|
41
|
protected $terms;
|
42
|
|
43
|
/**
|
44
|
* Provide the test's meta information.
|
45
|
*/
|
46
|
public static function getInfo() {
|
47
|
return array(
|
48
|
'name' => 'Handler: Many To One Helper',
|
49
|
'description' => 'Tests the many to one helper handler',
|
50
|
'group' => 'Views Handlers',
|
51
|
);
|
52
|
}
|
53
|
|
54
|
/**
|
55
|
* Clears views data cache.
|
56
|
*/
|
57
|
protected function clearViewsDataCache() {
|
58
|
drupal_static_reset('_views_fetch_data_cache');
|
59
|
drupal_static_reset('_views_fetch_data_recursion_protected');
|
60
|
drupal_static_reset('_views_fetch_data_fully_loaded');
|
61
|
}
|
62
|
|
63
|
/**
|
64
|
* Returns a new term with random properties.
|
65
|
*
|
66
|
* @param string $vocabulary
|
67
|
* Vocabulary ID to create term in.
|
68
|
*
|
69
|
* @return object
|
70
|
* Term with random properties.
|
71
|
*/
|
72
|
protected function createTerm($vocabulary) {
|
73
|
$term = new stdClass();
|
74
|
$term->name = $this->randomName();
|
75
|
$term->description = $this->randomName();
|
76
|
// Use the first available text format.
|
77
|
$term->format = db_query_range('SELECT format FROM {filter_format}', 0, 1)->fetchField();
|
78
|
$term->vid = $vocabulary->vid;
|
79
|
taxonomy_term_save($term);
|
80
|
return $term;
|
81
|
}
|
82
|
|
83
|
/**
|
84
|
* {@inheritdoc}
|
85
|
*/
|
86
|
public function setUp(array $modules = array()) {
|
87
|
parent::setUp($modules);
|
88
|
|
89
|
// Create boolean field.
|
90
|
$this->fields[0] = array(
|
91
|
'field_name' => 'field_bool',
|
92
|
'type' => 'list_boolean',
|
93
|
'cardinality' => 1,
|
94
|
'settings' => array(
|
95
|
'allowed_values' => array(
|
96
|
0 => '',
|
97
|
1 => '',
|
98
|
),
|
99
|
),
|
100
|
);
|
101
|
$this->fields[0] = field_create_field($this->fields[0]);
|
102
|
|
103
|
// Create text list field.
|
104
|
$this->fields[1] = array(
|
105
|
'field_name' => 'field_list',
|
106
|
'type' => 'list_text',
|
107
|
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
|
108
|
'settings' => array(
|
109
|
'allowed_values' => array(
|
110
|
1 => '1',
|
111
|
2 => '2',
|
112
|
3 => '3',
|
113
|
),
|
114
|
),
|
115
|
);
|
116
|
$this->fields[1] = field_create_field($this->fields[1]);
|
117
|
|
118
|
// Create boolean field instance for article nodes.
|
119
|
$instance = array(
|
120
|
'field_name' => $this->fields[0]['field_name'],
|
121
|
'entity_type' => 'node',
|
122
|
'bundle' => 'article',
|
123
|
'widget' => array(
|
124
|
'type' => 'options_onoff',
|
125
|
),
|
126
|
);
|
127
|
$this->instances[0][] = field_create_instance($instance);
|
128
|
|
129
|
// Create text list field instance for article nodes.
|
130
|
$instance = array(
|
131
|
'field_name' => $this->fields[1]['field_name'],
|
132
|
'entity_type' => 'node',
|
133
|
'bundle' => 'article',
|
134
|
'widget' => array(
|
135
|
'type' => 'options_buttons',
|
136
|
),
|
137
|
);
|
138
|
$this->instances[1][] = field_create_instance($instance);
|
139
|
|
140
|
// Create boolean field instance for users.
|
141
|
$instance = array(
|
142
|
'field_name' => $this->fields[0]['field_name'],
|
143
|
'entity_type' => 'user',
|
144
|
'bundle' => 'user',
|
145
|
'widget' => array(
|
146
|
'type' => 'options_onoff',
|
147
|
),
|
148
|
);
|
149
|
$this->instances[0][] = field_create_instance($instance);
|
150
|
|
151
|
// Create text list field instance for users.
|
152
|
$instance = array(
|
153
|
'field_name' => $this->fields[1]['field_name'],
|
154
|
'entity_type' => 'user',
|
155
|
'bundle' => 'user',
|
156
|
'widget' => array(
|
157
|
'type' => 'options_buttons',
|
158
|
),
|
159
|
);
|
160
|
$this->instances[1][] = field_create_instance($instance);
|
161
|
|
162
|
// Create tags field instance for users.
|
163
|
$instance = array(
|
164
|
'field_name' => 'field_tags',
|
165
|
'entity_type' => 'user',
|
166
|
'bundle' => 'user',
|
167
|
);
|
168
|
$this->instances[2][] = field_create_instance($instance);
|
169
|
|
170
|
// Clear views data cache.
|
171
|
$this->clearViewsDataCache();
|
172
|
|
173
|
// Create 62 tags.
|
174
|
$vocabulary = taxonomy_vocabulary_machine_name_load('tags');
|
175
|
for ($i = 0; $i < 62; $i++) {
|
176
|
$this->terms[] = $this->createTerm($vocabulary);
|
177
|
}
|
178
|
|
179
|
// Create a node where the field_bool is checked, field_list is '1' and
|
180
|
// tag is term 2.
|
181
|
$node = array();
|
182
|
$node['type'] = 'article';
|
183
|
$node[$this->fields[0]['field_name']][LANGUAGE_NONE][]['value'] = '1';
|
184
|
$node[$this->fields[1]['field_name']][LANGUAGE_NONE][]['value'] = '1';
|
185
|
$node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->terms[1]->tid;
|
186
|
$this->nodes[0] = $this->drupalCreateNode($node);
|
187
|
|
188
|
// Create a node where the field_bool is not checked, field_list is empty
|
189
|
// and tag is term 1.
|
190
|
$node = array();
|
191
|
$node['type'] = 'article';
|
192
|
$node[$this->fields[0]['field_name']] = array();
|
193
|
$node[$this->fields[1]['field_name']] = array();
|
194
|
$node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->terms[0]->tid;
|
195
|
$this->nodes[1] = $this->drupalCreateNode($node);
|
196
|
|
197
|
// Create a node where the field_bool is not checked, field_list is empty
|
198
|
// and tag is term 1 and 2.
|
199
|
$node = array();
|
200
|
$node['type'] = 'article';
|
201
|
$node[$this->fields[0]['field_name']] = array();
|
202
|
$node[$this->fields[1]['field_name']] = array();
|
203
|
$node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->terms[0]->tid;
|
204
|
$node['field_tags'][LANGUAGE_NONE][]['tid'] = $this->terms[1]->tid;
|
205
|
$this->nodes[2] = $this->drupalCreateNode($node);
|
206
|
|
207
|
// Create a user where field_bool is checked, field_list is '1' and tag is
|
208
|
// term 1.
|
209
|
$permissions = array('access content');
|
210
|
$account = $this->drupalCreateUser($permissions);
|
211
|
$account->{$this->fields[0]['field_name']}[LANGUAGE_NONE][]['value'] = '1';
|
212
|
$account->{$this->fields[1]['field_name']}[LANGUAGE_NONE][]['value'] = '1';
|
213
|
$account->field_tags[LANGUAGE_NONE][]['tid'] = $this->terms[0]->tid;
|
214
|
$this->accounts[0] = user_save($account);
|
215
|
}
|
216
|
|
217
|
/**
|
218
|
* Tests "none of" filter with terms in excess of JOIN limit selected.
|
219
|
*/
|
220
|
public function testJoinLimitNoneOf() {
|
221
|
$view = $this->getJoinLimitNoneOfTestView();
|
222
|
$this->executeView($view);
|
223
|
|
224
|
// Assert that nodes have been created and have expected field values.
|
225
|
$value = field_get_items('node', $this->nodes[0], 'field_tags', LANGUAGE_NONE);
|
226
|
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
|
227
|
$this->assertIdentical($value, 2, 'First node has been created and tags field references term 2.');
|
228
|
|
229
|
$value = field_get_items('node', $this->nodes[1], 'field_tags', LANGUAGE_NONE);
|
230
|
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
|
231
|
$this->assertIdentical($value, 1, 'Second node has been created and tags field references term 1.');
|
232
|
|
233
|
// Assert that user has been created and has expected field values.
|
234
|
$value = field_get_items('user', $this->accounts[0], 'field_tags', LANGUAGE_NONE);
|
235
|
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
|
236
|
$this->assertIdentical($value, 1, 'User has been created and tags field references term 1.');
|
237
|
|
238
|
// Assert that node id with empty field value matches user id so that the
|
239
|
// node would be excluded from the result, if the joins are missing extras.
|
240
|
$this->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node id of second node matches uid of first user.');
|
241
|
|
242
|
// Assert correct result set.
|
243
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
244
|
$this->assertEqual($result_count, 1, 'View has one result.');
|
245
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
246
|
$this->assertIdentical($nid, (int) $this->nodes[1]->nid, 'View result has correct node id.');
|
247
|
}
|
248
|
|
249
|
/**
|
250
|
* Tests duplicate grouped "none of" filters on boolean field.
|
251
|
*/
|
252
|
public function testGroupedNoneOf() {
|
253
|
$view = $this->getGroupedNoneOfTestView();
|
254
|
$this->executeView($view);
|
255
|
|
256
|
// Assert that nodes have been created and have expected field values.
|
257
|
$value = field_get_items('node', $this->nodes[0], $this->fields[0]['field_name'], LANGUAGE_NONE);
|
258
|
$value = isset($value[0]['value']) ? (int) $value[0]['value'] : 0;
|
259
|
$this->assertIdentical($value, 1, 'First node has been created and boolean field is checked.');
|
260
|
|
261
|
$value = field_get_items('node', $this->nodes[1], $this->fields[0]['field_name'], LANGUAGE_NONE);
|
262
|
$this->assertFalse($value, 'Second node has been created and boolean field is not checked.');
|
263
|
|
264
|
$value = field_get_items('node', $this->nodes[2], $this->fields[0]['field_name'], LANGUAGE_NONE);
|
265
|
$this->assertFalse($value, 'Third node has been created and boolean field is not checked.');
|
266
|
|
267
|
// Assert that user has been created and has expected field values.
|
268
|
$value = field_get_items('user', $this->accounts[0], $this->fields[0]['field_name'], LANGUAGE_NONE);
|
269
|
$value = isset($value[0]['value']) ? (int) $value[0]['value'] : 0;
|
270
|
$this->assertIdentical($value, 1, 'User has been created and boolean field is checked.');
|
271
|
|
272
|
// Assert that node ID with empty field value matches user ID so that the
|
273
|
// node would be excluded from the result, if the joins are missing extras.
|
274
|
$this->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node ID of second node matches UID of first user.');
|
275
|
|
276
|
// Assert correct result set.
|
277
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
278
|
$this->assertEqual($result_count, 2, 'View has two results.');
|
279
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
280
|
$result1 = ($nid === (int) $this->nodes[1]->nid);
|
281
|
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
|
282
|
$result2 = ($nid === (int) $this->nodes[2]->nid);
|
283
|
$this->assertTrue($result1 && $result2, 'View result has correct node IDs.');
|
284
|
}
|
285
|
|
286
|
/**
|
287
|
* Tests duplicate grouped "one of" filters on taxonomy term field.
|
288
|
*/
|
289
|
public function testGroupedOneOf() {
|
290
|
$view = $this->getGroupedOneOfTestView();
|
291
|
$this->executeView($view);
|
292
|
|
293
|
// Assert that nodes have been created and have expected field values.
|
294
|
$value = field_get_items('node', $this->nodes[0], 'field_tags', LANGUAGE_NONE);
|
295
|
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
|
296
|
$this->assertIdentical($value, 2, 'First node has been created and tags field references term 2.');
|
297
|
|
298
|
$value = field_get_items('node', $this->nodes[1], 'field_tags', LANGUAGE_NONE);
|
299
|
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
|
300
|
$this->assertIdentical($value, 1, 'Second node has been created and tags field references term 1.');
|
301
|
|
302
|
$value = field_get_items('node', $this->nodes[2], 'field_tags', LANGUAGE_NONE);
|
303
|
$value = !empty($value[0]['tid']) && !empty($value[1]['tid']);
|
304
|
$this->assertTrue($value, 'Third node has been created and tags field references both terms 1 and 2.');
|
305
|
|
306
|
// Assert that user has been created and has expected field values.
|
307
|
$value = field_get_items('user', $this->accounts[0], 'field_tags', LANGUAGE_NONE);
|
308
|
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
|
309
|
$this->assertIdentical($value, 1, 'User has been created and tags field references term 1.');
|
310
|
|
311
|
// Assert that node ID with empty field value matches user ID so that the
|
312
|
// node would be excluded from the result, if the joins are missing extras.
|
313
|
$this->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node ID of second node matches UID of first user.');
|
314
|
|
315
|
// Assert correct result set.
|
316
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
317
|
$this->assertEqual($result_count, 2, 'View has two results.');
|
318
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
319
|
$result1 = ($nid === (int) $this->nodes[1]->nid);
|
320
|
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
|
321
|
$result2 = ($nid === (int) $this->nodes[2]->nid);
|
322
|
$this->assertTrue($result1 && $result2, 'View result has correct node IDs.');
|
323
|
}
|
324
|
|
325
|
/**
|
326
|
* Tests exposed filter with "Reduce duplicates." and grouped options.
|
327
|
*/
|
328
|
public function testReducedExposedGroupedOptions() {
|
329
|
// Assert that nodes have been created and have expected field values.
|
330
|
$value = field_get_items('node', $this->nodes[0], 'field_list', LANGUAGE_NONE);
|
331
|
$value = isset($value[0]['value']) ? (int) $value[0]['value'] : 0;
|
332
|
$this->assertIdentical($value, 1, 'First node has been created and list field has value 1.');
|
333
|
|
334
|
$value = field_get_items('node', $this->nodes[1], 'field_list', LANGUAGE_NONE);
|
335
|
$this->assertFalse($value, 'Second node has been created and list field is empty.');
|
336
|
|
337
|
$value = field_get_items('node', $this->nodes[2], 'field_list', LANGUAGE_NONE);
|
338
|
$this->assertFalse($value, 'Third node has been created and list field is empty.');
|
339
|
|
340
|
// Assert that user has been created and has expected field values.
|
341
|
$value = field_get_items('user', $this->accounts[0], 'field_list', LANGUAGE_NONE);
|
342
|
$value = isset($value[0]['value']) ? (int) $value[0]['value'] : 0;
|
343
|
$this->assertIdentical($value, 1, 'User has been created and list field has value 1.');
|
344
|
|
345
|
// Assert that node ID with empty field value matches user ID so that the
|
346
|
// node would be excluded from the result option 1, if the joins are missing
|
347
|
// extras.
|
348
|
$this->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node ID of second node matches UID of first user.');
|
349
|
|
350
|
// Default option: Any.
|
351
|
$view = $this->getReducedExposedGroupedOptionsTestView();
|
352
|
$this->executeView($view);
|
353
|
|
354
|
// Assert correct result set.
|
355
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
356
|
$this->assertEqual($result_count, 3, 'Default option: View has three results.');
|
357
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
358
|
$result1 = ($nid === (int) $this->nodes[0]->nid);
|
359
|
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
|
360
|
$result2 = ($nid === (int) $this->nodes[1]->nid);
|
361
|
$nid = isset($view->result[2]->nid) ? (int) $view->result[2]->nid : 0;
|
362
|
$result3 = ($nid === (int) $this->nodes[2]->nid);
|
363
|
$this->assertTrue($result1 && $result2 && $result3, 'Default option: View result has correct node ID.');
|
364
|
|
365
|
// Option 1: Is none of 1 or 2.
|
366
|
$view = $this->getReducedExposedGroupedOptionsTestView();
|
367
|
$view->set_exposed_input(array(
|
368
|
'field_list_value' => '1',
|
369
|
));
|
370
|
$this->executeView($view);
|
371
|
|
372
|
// Assert correct result set.
|
373
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
374
|
$this->assertEqual($result_count, 2, 'Option 1: View has two results.');
|
375
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
376
|
$result1 = ($nid === (int) $this->nodes[1]->nid);
|
377
|
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
|
378
|
$result2 = ($nid === (int) $this->nodes[2]->nid);
|
379
|
$this->assertTrue($result1 && $result2, 'Option 1: View result has correct node ID.');
|
380
|
|
381
|
// Option 2: Is one of 1.
|
382
|
$view = $this->getReducedExposedGroupedOptionsTestView();
|
383
|
$view->set_exposed_input(array(
|
384
|
'field_list_value' => '2',
|
385
|
));
|
386
|
$this->executeView($view);
|
387
|
|
388
|
// Assert correct result set.
|
389
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
390
|
$this->assertEqual($result_count, 1, 'Option 2: View has one result.');
|
391
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
392
|
$this->assertIdentical($nid, (int) $this->nodes[0]->nid, 'Option 2: View result has correct node ID.');
|
393
|
|
394
|
// Option 3: Is one of 1 or 2.
|
395
|
$view = $this->getReducedExposedGroupedOptionsTestView();
|
396
|
$view->set_exposed_input(array(
|
397
|
'field_list_value' => '3',
|
398
|
));
|
399
|
$this->executeView($view);
|
400
|
|
401
|
// Assert correct result set.
|
402
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
403
|
$this->assertEqual($result_count, 1, 'Option 3: View has one result.');
|
404
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
405
|
$this->assertIdentical($nid, (int) $this->nodes[0]->nid, 'Option 3: View result has correct node ID.');
|
406
|
|
407
|
/* @todo: Fix and uncomment in issue #3045168.
|
408
|
* // Option 4: Is all of 1 and 2.
|
409
|
* $view = $this->getReducedExposedGroupedOptionsTestView();
|
410
|
* $view->set_exposed_input(array(
|
411
|
* 'field_list_value' => '4',
|
412
|
* ));
|
413
|
* $this->executeView($view);
|
414
|
*
|
415
|
* // Assert correct result set.
|
416
|
* $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 1;
|
417
|
* $this->assertEqual($result_count, 0, 'Option 4: View has empty result.');
|
418
|
*/
|
419
|
|
420
|
// Option 5: Is empty.
|
421
|
$view = $this->getReducedExposedGroupedOptionsTestView();
|
422
|
$view->set_exposed_input(array(
|
423
|
'field_list_value' => '5',
|
424
|
));
|
425
|
$this->executeView($view);
|
426
|
|
427
|
// Assert correct result set.
|
428
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
429
|
$this->assertEqual($result_count, 2, 'Option 5: View has two results.');
|
430
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
431
|
$result1 = ($nid === (int) $this->nodes[1]->nid);
|
432
|
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
|
433
|
$result2 = ($nid === (int) $this->nodes[2]->nid);
|
434
|
$this->assertTrue($result1 && $result2, 'Option 5: View result has correct node IDs.');
|
435
|
|
436
|
// Option 6: Is not empty.
|
437
|
$view = $this->getReducedExposedGroupedOptionsTestView();
|
438
|
$view->set_exposed_input(array(
|
439
|
'field_list_value' => '6',
|
440
|
));
|
441
|
$this->executeView($view);
|
442
|
|
443
|
// Assert correct result set.
|
444
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
445
|
$this->assertEqual($result_count, 1, 'Option 6: View has one result.');
|
446
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
447
|
$this->assertIdentical($nid, (int) $this->nodes[0]->nid, 'Option 6: View result has correct node ID.');
|
448
|
}
|
449
|
|
450
|
/**
|
451
|
* Tests exposed filter on term ID with grouped options.
|
452
|
*/
|
453
|
public function testTermIdExposedGroupedOptions() {
|
454
|
// Assert that nodes have been created and have expected field values.
|
455
|
$value = field_get_items('node', $this->nodes[0], 'field_tags', LANGUAGE_NONE);
|
456
|
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
|
457
|
$this->assertIdentical($value, 2, 'First node has been created and tags field references term 2.');
|
458
|
|
459
|
$value = field_get_items('node', $this->nodes[1], 'field_tags', LANGUAGE_NONE);
|
460
|
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
|
461
|
$this->assertIdentical($value, 1, 'Second node has been created and tags field references term 1.');
|
462
|
|
463
|
// Assert that user has been created and has expected field values.
|
464
|
$value = field_get_items('user', $this->accounts[0], 'field_tags', LANGUAGE_NONE);
|
465
|
$value = isset($value[0]['tid']) ? (int) $value[0]['tid'] : 0;
|
466
|
$this->assertIdentical($value, 1, 'User has been created and tags field references term 1.');
|
467
|
|
468
|
// Assert that node ID with empty field value matches user ID so that the
|
469
|
// node would be excluded from the result option 1, if the joins are missing
|
470
|
// extras.
|
471
|
$this->assertIdentical((int) $this->accounts[0]->uid, (int) $this->nodes[1]->nid, 'Node ID of second node matches UID of first user.');
|
472
|
|
473
|
// Default option: Any.
|
474
|
$view = $this->getTermIdExposedGroupedOptionsTestView();
|
475
|
$this->executeView($view);
|
476
|
|
477
|
// Assert correct result set.
|
478
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
479
|
$this->assertEqual($result_count, 3, 'Default option: View has three results.');
|
480
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
481
|
$result1 = ($nid === (int) $this->nodes[0]->nid);
|
482
|
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
|
483
|
$result2 = ($nid === (int) $this->nodes[1]->nid);
|
484
|
$nid = isset($view->result[2]->nid) ? (int) $view->result[2]->nid : 0;
|
485
|
$result3 = ($nid === (int) $this->nodes[2]->nid);
|
486
|
$this->assertTrue($result1 && $result2 && $result3, 'Default option: View result has correct node ID.');
|
487
|
|
488
|
// Option 1: Is none of 2.
|
489
|
$view = $this->getTermIdExposedGroupedOptionsTestView();
|
490
|
$view->set_exposed_input(array(
|
491
|
'field_tags_tid' => '1',
|
492
|
));
|
493
|
$this->executeView($view);
|
494
|
|
495
|
// Assert correct result set.
|
496
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
497
|
$this->assertEqual($result_count, 1, 'Option 1: View has one result.');
|
498
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
499
|
$this->assertIdentical($nid, (int) $this->nodes[1]->nid, 'Option 1: View result has correct node ID.');
|
500
|
|
501
|
// Option 2: Is none of 1 or 2.
|
502
|
$view = $this->getTermIdExposedGroupedOptionsTestView();
|
503
|
$view->set_exposed_input(array(
|
504
|
'field_tags_tid' => '2',
|
505
|
));
|
506
|
$this->executeView($view);
|
507
|
|
508
|
// Assert correct result set.
|
509
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 1;
|
510
|
$this->assertEqual($result_count, 0, 'Option 2: View has empty result.');
|
511
|
|
512
|
// Option 3: Is one of 1.
|
513
|
$view = $this->getTermIdExposedGroupedOptionsTestView();
|
514
|
$view->set_exposed_input(array(
|
515
|
'field_tags_tid' => '3',
|
516
|
));
|
517
|
$this->executeView($view);
|
518
|
|
519
|
// Assert correct result set.
|
520
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
521
|
$this->assertEqual($result_count, 2, 'Option 3: View has two results.');
|
522
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
523
|
$result1 = ($nid === (int) $this->nodes[1]->nid);
|
524
|
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
|
525
|
$result2 = ($nid === (int) $this->nodes[2]->nid);
|
526
|
$this->assertTrue($result1 && $result2, 'Option 3: View result has correct node ID.');
|
527
|
|
528
|
// Option 4: Is one of 1 or 2.
|
529
|
$view = $this->getTermIdExposedGroupedOptionsTestView();
|
530
|
$view->set_exposed_input(array(
|
531
|
'field_tags_tid' => '4',
|
532
|
));
|
533
|
$this->executeView($view);
|
534
|
|
535
|
// Assert correct result set.
|
536
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
537
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
538
|
$result1 = ($nid === (int) $this->nodes[0]->nid);
|
539
|
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
|
540
|
$result2 = ($nid === (int) $this->nodes[1]->nid);
|
541
|
$nid = isset($view->result[2]->nid) ? (int) $view->result[2]->nid : 0;
|
542
|
$result3 = ($nid === (int) $this->nodes[2]->nid);
|
543
|
$nid = isset($view->result[3]->nid) ? (int) $view->result[3]->nid : 0;
|
544
|
$result4 = ($nid === (int) $this->nodes[2]->nid);
|
545
|
$this->assertTrue($result1 && $result2 && $result3 && $result4, 'Option 4: View result has correct node ID.');
|
546
|
$this->verbose($view->result);
|
547
|
$this->assertEqual($result_count, 4, 'Option 4: View has four results.');
|
548
|
|
549
|
/* @todo: Fix and uncomment in issue #3045168.
|
550
|
* // Option 5: Is all of 1 and 2.
|
551
|
* $view = $this->getTermIdExposedGroupedOptionsTestView();
|
552
|
* $view->set_exposed_input(array(
|
553
|
* 'field_tags_tid' => '5',
|
554
|
* ));
|
555
|
* $this->executeView($view);
|
556
|
*
|
557
|
* // Assert correct result set.
|
558
|
* $result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
559
|
* $nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
560
|
* $this->assertIdentical($nid, (int) $this->nodes[2]->nid, 'Option 5: View result has correct node ID.');
|
561
|
* $this->assertIdentical($result_count, 1, 'Option 5: View has one result.');
|
562
|
*/
|
563
|
|
564
|
// Option 6: Is empty.
|
565
|
$view = $this->getTermIdExposedGroupedOptionsTestView();
|
566
|
$view->set_exposed_input(array(
|
567
|
'field_tags_tid' => '6',
|
568
|
));
|
569
|
$this->executeView($view);
|
570
|
|
571
|
// Assert correct result set.
|
572
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 1;
|
573
|
$this->assertIdentical($result_count, 0, 'Option 6: View has empty result.');
|
574
|
|
575
|
// Option 7: Is not empty.
|
576
|
$view = $this->getTermIdExposedGroupedOptionsTestView();
|
577
|
$view->set_exposed_input(array(
|
578
|
'field_tags_tid' => '7',
|
579
|
));
|
580
|
$this->executeView($view);
|
581
|
|
582
|
// Assert correct result set.
|
583
|
$result_count = isset($view->result) && is_array($view->result) ? count($view->result) : 0;
|
584
|
$nid = isset($view->result[0]->nid) ? (int) $view->result[0]->nid : 0;
|
585
|
$result1 = ($nid === (int) $this->nodes[0]->nid);
|
586
|
$nid = isset($view->result[1]->nid) ? (int) $view->result[1]->nid : 0;
|
587
|
$result2 = ($nid === (int) $this->nodes[1]->nid);
|
588
|
$nid = isset($view->result[2]->nid) ? (int) $view->result[2]->nid : 0;
|
589
|
$result3 = ($nid === (int) $this->nodes[2]->nid);
|
590
|
$nid = isset($view->result[3]->nid) ? (int) $view->result[3]->nid : 0;
|
591
|
$result4 = ($nid === (int) $this->nodes[2]->nid);
|
592
|
$this->assertTrue($result1 && $result2 && $result3 && $result4, 'Option 7: View result has correct node ID.');
|
593
|
$this->verbose($view->result);
|
594
|
$this->assertIdentical($result_count, 4, 'Option 7: View has four results.');
|
595
|
}
|
596
|
|
597
|
/**
|
598
|
* Generates test_not view.
|
599
|
*/
|
600
|
protected function getGroupedNoneOfTestView() {
|
601
|
$view = new view();
|
602
|
$view->name = 'test_not';
|
603
|
$view->description = '';
|
604
|
$view->tag = 'default';
|
605
|
$view->base_table = 'node';
|
606
|
$view->human_name = 'test_not';
|
607
|
$view->core = 7;
|
608
|
$view->api_version = '3.0';
|
609
|
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
|
610
|
|
611
|
/* Display: Master */
|
612
|
$handler = $view->new_display('default', 'Master', 'default');
|
613
|
$handler->display->display_options['use_more_always'] = FALSE;
|
614
|
$handler->display->display_options['access']['type'] = 'perm';
|
615
|
$handler->display->display_options['cache']['type'] = 'none';
|
616
|
$handler->display->display_options['query']['type'] = 'views_query';
|
617
|
$handler->display->display_options['exposed_form']['type'] = 'basic';
|
618
|
$handler->display->display_options['pager']['type'] = 'full';
|
619
|
$handler->display->display_options['style_plugin'] = 'default';
|
620
|
$handler->display->display_options['row_plugin'] = 'fields';
|
621
|
/* Field: Content: Title */
|
622
|
$handler->display->display_options['fields']['title']['id'] = 'title';
|
623
|
$handler->display->display_options['fields']['title']['table'] = 'node';
|
624
|
$handler->display->display_options['fields']['title']['field'] = 'title';
|
625
|
$handler->display->display_options['fields']['title']['label'] = '';
|
626
|
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
627
|
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
628
|
/* Sort criterion: Content: Nid */
|
629
|
$handler->display->display_options['sorts']['nid']['id'] = 'nid';
|
630
|
$handler->display->display_options['sorts']['nid']['table'] = 'node';
|
631
|
$handler->display->display_options['sorts']['nid']['field'] = 'nid';
|
632
|
$handler->display->display_options['filter_groups']['operator'] = 'OR';
|
633
|
$handler->display->display_options['filter_groups']['groups'] = array(
|
634
|
1 => 'AND',
|
635
|
2 => 'AND',
|
636
|
);
|
637
|
/* Filter criterion: Content: Published */
|
638
|
$handler->display->display_options['filters']['status']['id'] = 'status';
|
639
|
$handler->display->display_options['filters']['status']['table'] = 'node';
|
640
|
$handler->display->display_options['filters']['status']['field'] = 'status';
|
641
|
$handler->display->display_options['filters']['status']['value'] = 1;
|
642
|
$handler->display->display_options['filters']['status']['group'] = 1;
|
643
|
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
|
644
|
/* Filter criterion: Content: Type */
|
645
|
$handler->display->display_options['filters']['type']['id'] = 'type';
|
646
|
$handler->display->display_options['filters']['type']['table'] = 'node';
|
647
|
$handler->display->display_options['filters']['type']['field'] = 'type';
|
648
|
$handler->display->display_options['filters']['type']['value'] = array(
|
649
|
'article' => 'article',
|
650
|
);
|
651
|
$handler->display->display_options['filters']['type']['group'] = 1;
|
652
|
/* Filter criterion: Field: field_bool (field_bool) */
|
653
|
$handler->display->display_options['filters']['field_bool_value']['id'] = 'field_bool_value';
|
654
|
$handler->display->display_options['filters']['field_bool_value']['table'] = 'field_data_field_bool';
|
655
|
$handler->display->display_options['filters']['field_bool_value']['field'] = 'field_bool_value';
|
656
|
$handler->display->display_options['filters']['field_bool_value']['operator'] = 'not';
|
657
|
$handler->display->display_options['filters']['field_bool_value']['value'] = array(
|
658
|
1 => '1',
|
659
|
);
|
660
|
$handler->display->display_options['filters']['field_bool_value']['group'] = 1;
|
661
|
/* Filter criterion: Field: field_bool (field_bool) */
|
662
|
$handler->display->display_options['filters']['field_bool_value_1']['id'] = 'field_bool_value_1';
|
663
|
$handler->display->display_options['filters']['field_bool_value_1']['table'] = 'field_data_field_bool';
|
664
|
$handler->display->display_options['filters']['field_bool_value_1']['field'] = 'field_bool_value';
|
665
|
$handler->display->display_options['filters']['field_bool_value_1']['operator'] = 'not';
|
666
|
$handler->display->display_options['filters']['field_bool_value_1']['value'] = array(
|
667
|
1 => '1',
|
668
|
);
|
669
|
$handler->display->display_options['filters']['field_bool_value_1']['group'] = 2;
|
670
|
/* Filter criterion: Content: Type */
|
671
|
$handler->display->display_options['filters']['type_1']['id'] = 'type_1';
|
672
|
$handler->display->display_options['filters']['type_1']['table'] = 'node';
|
673
|
$handler->display->display_options['filters']['type_1']['field'] = 'type';
|
674
|
$handler->display->display_options['filters']['type_1']['value'] = array(
|
675
|
'article' => 'article',
|
676
|
);
|
677
|
$handler->display->display_options['filters']['type_1']['group'] = 2;
|
678
|
/* Filter criterion: Content: Published */
|
679
|
$handler->display->display_options['filters']['status_1']['id'] = 'status_1';
|
680
|
$handler->display->display_options['filters']['status_1']['table'] = 'node';
|
681
|
$handler->display->display_options['filters']['status_1']['field'] = 'status';
|
682
|
$handler->display->display_options['filters']['status_1']['value'] = '1';
|
683
|
$handler->display->display_options['filters']['status_1']['group'] = 2;
|
684
|
|
685
|
return $view;
|
686
|
}
|
687
|
|
688
|
/**
|
689
|
* Generates test_oneof view.
|
690
|
*/
|
691
|
protected function getGroupedOneOfTestView() {
|
692
|
$view = new view();
|
693
|
$view->name = 'test_oneof';
|
694
|
$view->description = '';
|
695
|
$view->tag = 'default';
|
696
|
$view->base_table = 'node';
|
697
|
$view->human_name = 'test_oneof';
|
698
|
$view->core = 7;
|
699
|
$view->api_version = '3.0';
|
700
|
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
|
701
|
|
702
|
/* Display: Master */
|
703
|
$handler = $view->new_display('default', 'Master', 'default');
|
704
|
$handler->display->display_options['use_more_always'] = FALSE;
|
705
|
$handler->display->display_options['access']['type'] = 'perm';
|
706
|
$handler->display->display_options['cache']['type'] = 'none';
|
707
|
$handler->display->display_options['query']['type'] = 'views_query';
|
708
|
$handler->display->display_options['exposed_form']['type'] = 'basic';
|
709
|
$handler->display->display_options['pager']['type'] = 'full';
|
710
|
$handler->display->display_options['style_plugin'] = 'default';
|
711
|
$handler->display->display_options['row_plugin'] = 'fields';
|
712
|
/* Field: Content: Title */
|
713
|
$handler->display->display_options['fields']['title']['id'] = 'title';
|
714
|
$handler->display->display_options['fields']['title']['table'] = 'node';
|
715
|
$handler->display->display_options['fields']['title']['field'] = 'title';
|
716
|
$handler->display->display_options['fields']['title']['label'] = '';
|
717
|
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
718
|
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
719
|
/* Sort criterion: Content: Nid */
|
720
|
$handler->display->display_options['sorts']['nid']['id'] = 'nid';
|
721
|
$handler->display->display_options['sorts']['nid']['table'] = 'node';
|
722
|
$handler->display->display_options['sorts']['nid']['field'] = 'nid';
|
723
|
$handler->display->display_options['filter_groups']['operator'] = 'OR';
|
724
|
$handler->display->display_options['filter_groups']['groups'] = array(
|
725
|
1 => 'AND',
|
726
|
2 => 'AND',
|
727
|
);
|
728
|
/* Filter criterion: Content: Tags (field_tags) */
|
729
|
$handler->display->display_options['filters']['field_tags_tid']['id'] = 'field_tags_tid';
|
730
|
$handler->display->display_options['filters']['field_tags_tid']['table'] = 'field_data_field_tags';
|
731
|
$handler->display->display_options['filters']['field_tags_tid']['field'] = 'field_tags_tid';
|
732
|
$handler->display->display_options['filters']['field_tags_tid']['value'] = array(
|
733
|
1 => '1',
|
734
|
);
|
735
|
$handler->display->display_options['filters']['field_tags_tid']['group'] = 2;
|
736
|
$handler->display->display_options['filters']['field_tags_tid']['reduce_duplicates'] = TRUE;
|
737
|
$handler->display->display_options['filters']['field_tags_tid']['type'] = 'select';
|
738
|
$handler->display->display_options['filters']['field_tags_tid']['vocabulary'] = 'tags';
|
739
|
/* Filter criterion: Content: Tags (field_tags) */
|
740
|
$handler->display->display_options['filters']['field_tags_tid_1']['id'] = 'field_tags_tid_1';
|
741
|
$handler->display->display_options['filters']['field_tags_tid_1']['table'] = 'field_data_field_tags';
|
742
|
$handler->display->display_options['filters']['field_tags_tid_1']['field'] = 'field_tags_tid';
|
743
|
$handler->display->display_options['filters']['field_tags_tid_1']['value'] = array(
|
744
|
1 => '1',
|
745
|
);
|
746
|
$handler->display->display_options['filters']['field_tags_tid_1']['reduce_duplicates'] = TRUE;
|
747
|
$handler->display->display_options['filters']['field_tags_tid_1']['type'] = 'select';
|
748
|
$handler->display->display_options['filters']['field_tags_tid_1']['vocabulary'] = 'tags';
|
749
|
return $view;
|
750
|
}
|
751
|
|
752
|
/**
|
753
|
* Generates test_reduced_exposed_grouped_options view.
|
754
|
*/
|
755
|
protected function getReducedExposedGroupedOptionsTestView() {
|
756
|
$view = new view();
|
757
|
$view->name = 'test_reduced_exposed_grouped_options';
|
758
|
$view->description = '';
|
759
|
$view->tag = 'default';
|
760
|
$view->base_table = 'node';
|
761
|
$view->human_name = 'test_reduced_exposed_grouped_options';
|
762
|
$view->core = 7;
|
763
|
$view->api_version = '3.0';
|
764
|
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
|
765
|
|
766
|
/* Display: Master */
|
767
|
$handler = $view->new_display('default', 'Master', 'default');
|
768
|
$handler->display->display_options['use_more_always'] = FALSE;
|
769
|
$handler->display->display_options['access']['type'] = 'perm';
|
770
|
$handler->display->display_options['cache']['type'] = 'none';
|
771
|
$handler->display->display_options['query']['type'] = 'views_query';
|
772
|
$handler->display->display_options['exposed_form']['type'] = 'basic';
|
773
|
$handler->display->display_options['pager']['type'] = 'full';
|
774
|
$handler->display->display_options['style_plugin'] = 'default';
|
775
|
$handler->display->display_options['row_plugin'] = 'fields';
|
776
|
/* Field: Content: Title */
|
777
|
$handler->display->display_options['fields']['title']['id'] = 'title';
|
778
|
$handler->display->display_options['fields']['title']['table'] = 'node';
|
779
|
$handler->display->display_options['fields']['title']['field'] = 'title';
|
780
|
$handler->display->display_options['fields']['title']['label'] = '';
|
781
|
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
782
|
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
783
|
/* Sort criterion: Content: Nid */
|
784
|
$handler->display->display_options['sorts']['nid']['id'] = 'nid';
|
785
|
$handler->display->display_options['sorts']['nid']['table'] = 'node';
|
786
|
$handler->display->display_options['sorts']['nid']['field'] = 'nid';
|
787
|
/* Filter criterion: Content: Published */
|
788
|
$handler->display->display_options['filters']['status']['id'] = 'status';
|
789
|
$handler->display->display_options['filters']['status']['table'] = 'node';
|
790
|
$handler->display->display_options['filters']['status']['field'] = 'status';
|
791
|
$handler->display->display_options['filters']['status']['value'] = 1;
|
792
|
$handler->display->display_options['filters']['status']['group'] = 1;
|
793
|
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
|
794
|
/* Filter criterion: Content: list (field_list) */
|
795
|
$handler->display->display_options['filters']['field_list_value']['id'] = 'field_list_value';
|
796
|
$handler->display->display_options['filters']['field_list_value']['table'] = 'field_data_field_list';
|
797
|
$handler->display->display_options['filters']['field_list_value']['field'] = 'field_list_value';
|
798
|
$handler->display->display_options['filters']['field_list_value']['exposed'] = TRUE;
|
799
|
$handler->display->display_options['filters']['field_list_value']['expose']['operator_id'] = 'field_list_value_op';
|
800
|
$handler->display->display_options['filters']['field_list_value']['expose']['label'] = 'list (field_list)';
|
801
|
$handler->display->display_options['filters']['field_list_value']['expose']['operator'] = 'field_list_value_op';
|
802
|
$handler->display->display_options['filters']['field_list_value']['expose']['identifier'] = 'field_list_value';
|
803
|
$handler->display->display_options['filters']['field_list_value']['is_grouped'] = TRUE;
|
804
|
$handler->display->display_options['filters']['field_list_value']['group_info']['label'] = 'list (field_list)';
|
805
|
$handler->display->display_options['filters']['field_list_value']['group_info']['identifier'] = 'field_list_value';
|
806
|
$handler->display->display_options['filters']['field_list_value']['group_info']['group_items'] = array(
|
807
|
1 => array(
|
808
|
'title' => 'Not 1 or 2',
|
809
|
'operator' => 'not',
|
810
|
'value' => array(
|
811
|
1 => '1',
|
812
|
2 => '2',
|
813
|
),
|
814
|
),
|
815
|
2 => array(
|
816
|
'title' => '1',
|
817
|
'operator' => 'or',
|
818
|
'value' => array(
|
819
|
1 => '1',
|
820
|
),
|
821
|
),
|
822
|
3 => array(
|
823
|
'title' => '1 or 2',
|
824
|
'operator' => 'or',
|
825
|
'value' => array(
|
826
|
1 => '1',
|
827
|
2 => '2',
|
828
|
),
|
829
|
),
|
830
|
4 => array(
|
831
|
'title' => '1 and 2',
|
832
|
'operator' => 'and',
|
833
|
'value' => array(
|
834
|
1 => '1',
|
835
|
2 => '2',
|
836
|
),
|
837
|
),
|
838
|
5 => array(
|
839
|
'title' => 'empty',
|
840
|
'operator' => 'empty',
|
841
|
'value' => array(),
|
842
|
),
|
843
|
6 => array(
|
844
|
'title' => 'not empty',
|
845
|
'operator' => 'not empty',
|
846
|
'value' => array(),
|
847
|
),
|
848
|
);
|
849
|
return $view;
|
850
|
}
|
851
|
|
852
|
/**
|
853
|
* Generates test_tid_exposed_grouped_options view.
|
854
|
*/
|
855
|
protected function getTermIdExposedGroupedOptionsTestView() {
|
856
|
$view = new view();
|
857
|
$view->name = 'test_tid_exposed_grouped_options';
|
858
|
$view->description = '';
|
859
|
$view->tag = 'default';
|
860
|
$view->base_table = 'node';
|
861
|
$view->human_name = 'test_tid_exposed_grouped_options';
|
862
|
$view->core = 7;
|
863
|
$view->api_version = '3.0';
|
864
|
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
|
865
|
|
866
|
/* Display: Master */
|
867
|
$handler = $view->new_display('default', 'Master', 'default');
|
868
|
$handler->display->display_options['use_more_always'] = FALSE;
|
869
|
$handler->display->display_options['access']['type'] = 'perm';
|
870
|
$handler->display->display_options['cache']['type'] = 'none';
|
871
|
$handler->display->display_options['query']['type'] = 'views_query';
|
872
|
$handler->display->display_options['exposed_form']['type'] = 'basic';
|
873
|
$handler->display->display_options['pager']['type'] = 'full';
|
874
|
$handler->display->display_options['style_plugin'] = 'default';
|
875
|
$handler->display->display_options['row_plugin'] = 'fields';
|
876
|
/* Field: Content: Title */
|
877
|
$handler->display->display_options['fields']['title']['id'] = 'title';
|
878
|
$handler->display->display_options['fields']['title']['table'] = 'node';
|
879
|
$handler->display->display_options['fields']['title']['field'] = 'title';
|
880
|
$handler->display->display_options['fields']['title']['label'] = '';
|
881
|
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
882
|
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
883
|
/* Sort criterion: Content: Nid */
|
884
|
$handler->display->display_options['sorts']['nid']['id'] = 'nid';
|
885
|
$handler->display->display_options['sorts']['nid']['table'] = 'node';
|
886
|
$handler->display->display_options['sorts']['nid']['field'] = 'nid';
|
887
|
/* Filter criterion: Content: Published */
|
888
|
$handler->display->display_options['filters']['status']['id'] = 'status';
|
889
|
$handler->display->display_options['filters']['status']['table'] = 'node';
|
890
|
$handler->display->display_options['filters']['status']['field'] = 'status';
|
891
|
$handler->display->display_options['filters']['status']['value'] = 1;
|
892
|
$handler->display->display_options['filters']['status']['group'] = 1;
|
893
|
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
|
894
|
/* Filter criterion: Content: Tags (field_tags) */
|
895
|
$handler->display->display_options['filters']['field_tags_tid']['id'] = 'field_tags_tid';
|
896
|
$handler->display->display_options['filters']['field_tags_tid']['table'] = 'field_data_field_tags';
|
897
|
$handler->display->display_options['filters']['field_tags_tid']['field'] = 'field_tags_tid';
|
898
|
$handler->display->display_options['filters']['field_tags_tid']['value'] = array(
|
899
|
1 => '1',
|
900
|
2 => '2',
|
901
|
);
|
902
|
$handler->display->display_options['filters']['field_tags_tid']['exposed'] = TRUE;
|
903
|
$handler->display->display_options['filters']['field_tags_tid']['expose']['operator_id'] = 'field_tags_tid_op';
|
904
|
$handler->display->display_options['filters']['field_tags_tid']['expose']['label'] = 'Tags (field_tags)';
|
905
|
$handler->display->display_options['filters']['field_tags_tid']['expose']['operator'] = 'field_tags_tid_op';
|
906
|
$handler->display->display_options['filters']['field_tags_tid']['expose']['identifier'] = 'field_tags_tid';
|
907
|
$handler->display->display_options['filters']['field_tags_tid']['expose']['remember_roles'] = array(
|
908
|
2 => '2',
|
909
|
);
|
910
|
$handler->display->display_options['filters']['field_tags_tid']['is_grouped'] = TRUE;
|
911
|
$handler->display->display_options['filters']['field_tags_tid']['group_info']['label'] = 'Tags (field_tags)';
|
912
|
$handler->display->display_options['filters']['field_tags_tid']['group_info']['identifier'] = 'field_tags_tid';
|
913
|
$handler->display->display_options['filters']['field_tags_tid']['group_info']['group_items'] = array(
|
914
|
1 => array(
|
915
|
'title' => 'Is none of 2',
|
916
|
'operator' => 'not',
|
917
|
'value' => array(
|
918
|
2 => '2',
|
919
|
),
|
920
|
),
|
921
|
2 => array(
|
922
|
'title' => 'Is none of 1 or 2',
|
923
|
'operator' => 'not',
|
924
|
'value' => array(
|
925
|
1 => '1',
|
926
|
2 => '2',
|
927
|
),
|
928
|
),
|
929
|
3 => array(
|
930
|
'title' => 'Is one of 1',
|
931
|
'operator' => 'or',
|
932
|
'value' => array(
|
933
|
1 => '1',
|
934
|
),
|
935
|
),
|
936
|
4 => array(
|
937
|
'title' => 'Is one of 1 or 2',
|
938
|
'operator' => 'or',
|
939
|
'value' => array(
|
940
|
1 => '1',
|
941
|
2 => '2',
|
942
|
),
|
943
|
),
|
944
|
5 => array(
|
945
|
'title' => 'Is all of 1 and 2',
|
946
|
'operator' => 'and',
|
947
|
'value' => array(
|
948
|
1 => '1',
|
949
|
2 => '2',
|
950
|
),
|
951
|
),
|
952
|
6 => array(
|
953
|
'title' => 'Is empty',
|
954
|
'operator' => 'empty',
|
955
|
'value' => array(
|
956
|
1 => '1',
|
957
|
2 => '2',
|
958
|
),
|
959
|
),
|
960
|
7 => array(
|
961
|
'title' => 'Is not empty',
|
962
|
'operator' => 'not empty',
|
963
|
'value' => array(
|
964
|
1 => '1',
|
965
|
2 => '2',
|
966
|
),
|
967
|
),
|
968
|
);
|
969
|
$handler->display->display_options['filters']['field_tags_tid']['type'] = 'select';
|
970
|
$handler->display->display_options['filters']['field_tags_tid']['vocabulary'] = 'tags';
|
971
|
return $view;
|
972
|
}
|
973
|
|
974
|
/**
|
975
|
* Generates test_join_limit_none_of view.
|
976
|
*/
|
977
|
protected function getJoinLimitNoneOfTestView() {
|
978
|
$view = new view();
|
979
|
$view->name = 'test_join_limit_none_of';
|
980
|
$view->description = '';
|
981
|
$view->tag = 'default';
|
982
|
$view->base_table = 'node';
|
983
|
$view->human_name = 'test_join_limit_none_of';
|
984
|
$view->core = 7;
|
985
|
$view->api_version = '3.0';
|
986
|
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
|
987
|
|
988
|
/* Display: Master */
|
989
|
$handler = $view->new_display('default', 'Master', 'default');
|
990
|
$handler->display->display_options['use_more_always'] = FALSE;
|
991
|
$handler->display->display_options['access']['type'] = 'perm';
|
992
|
$handler->display->display_options['cache']['type'] = 'none';
|
993
|
$handler->display->display_options['query']['type'] = 'views_query';
|
994
|
$handler->display->display_options['exposed_form']['type'] = 'basic';
|
995
|
$handler->display->display_options['pager']['type'] = 'full';
|
996
|
$handler->display->display_options['style_plugin'] = 'default';
|
997
|
$handler->display->display_options['row_plugin'] = 'fields';
|
998
|
/* Field: Content: Title */
|
999
|
$handler->display->display_options['fields']['title']['id'] = 'title';
|
1000
|
$handler->display->display_options['fields']['title']['table'] = 'node';
|
1001
|
$handler->display->display_options['fields']['title']['field'] = 'title';
|
1002
|
$handler->display->display_options['fields']['title']['label'] = '';
|
1003
|
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
1004
|
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
1005
|
/* Sort criterion: Content: Post date */
|
1006
|
$handler->display->display_options['sorts']['created']['id'] = 'created';
|
1007
|
$handler->display->display_options['sorts']['created']['table'] = 'node';
|
1008
|
$handler->display->display_options['sorts']['created']['field'] = 'created';
|
1009
|
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
|
1010
|
/* Filter criterion: Content: Published */
|
1011
|
$handler->display->display_options['filters']['status']['id'] = 'status';
|
1012
|
$handler->display->display_options['filters']['status']['table'] = 'node';
|
1013
|
$handler->display->display_options['filters']['status']['field'] = 'status';
|
1014
|
$handler->display->display_options['filters']['status']['value'] = 1;
|
1015
|
$handler->display->display_options['filters']['status']['group'] = 1;
|
1016
|
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
|
1017
|
/* Filter criterion: Content: Tags (field_tags) */
|
1018
|
$handler->display->display_options['filters']['field_tags_tid']['id'] = 'field_tags_tid';
|
1019
|
$handler->display->display_options['filters']['field_tags_tid']['table'] = 'field_data_field_tags';
|
1020
|
$handler->display->display_options['filters']['field_tags_tid']['field'] = 'field_tags_tid';
|
1021
|
$handler->display->display_options['filters']['field_tags_tid']['operator'] = 'not';
|
1022
|
$handler->display->display_options['filters']['field_tags_tid']['value'] = array(
|
1023
|
2 => '2',
|
1024
|
3 => '3',
|
1025
|
4 => '4',
|
1026
|
5 => '5',
|
1027
|
6 => '6',
|
1028
|
7 => '7',
|
1029
|
8 => '8',
|
1030
|
9 => '9',
|
1031
|
10 => '10',
|
1032
|
11 => '11',
|
1033
|
12 => '12',
|
1034
|
13 => '13',
|
1035
|
14 => '14',
|
1036
|
15 => '15',
|
1037
|
16 => '16',
|
1038
|
17 => '17',
|
1039
|
18 => '18',
|
1040
|
19 => '19',
|
1041
|
20 => '20',
|
1042
|
21 => '21',
|
1043
|
22 => '22',
|
1044
|
23 => '23',
|
1045
|
24 => '24',
|
1046
|
25 => '25',
|
1047
|
26 => '26',
|
1048
|
27 => '27',
|
1049
|
28 => '28',
|
1050
|
29 => '29',
|
1051
|
30 => '30',
|
1052
|
31 => '31',
|
1053
|
32 => '32',
|
1054
|
33 => '33',
|
1055
|
34 => '34',
|
1056
|
35 => '35',
|
1057
|
36 => '36',
|
1058
|
37 => '37',
|
1059
|
38 => '38',
|
1060
|
39 => '39',
|
1061
|
40 => '40',
|
1062
|
41 => '41',
|
1063
|
42 => '42',
|
1064
|
43 => '43',
|
1065
|
44 => '44',
|
1066
|
45 => '45',
|
1067
|
46 => '46',
|
1068
|
47 => '47',
|
1069
|
48 => '48',
|
1070
|
49 => '49',
|
1071
|
50 => '50',
|
1072
|
51 => '51',
|
1073
|
52 => '52',
|
1074
|
53 => '53',
|
1075
|
54 => '54',
|
1076
|
55 => '55',
|
1077
|
56 => '56',
|
1078
|
57 => '57',
|
1079
|
58 => '58',
|
1080
|
59 => '59',
|
1081
|
60 => '60',
|
1082
|
61 => '61',
|
1083
|
62 => '62',
|
1084
|
63 => '63',
|
1085
|
64 => '64',
|
1086
|
65 => '65',
|
1087
|
66 => '66',
|
1088
|
67 => '67',
|
1089
|
68 => '68',
|
1090
|
69 => '69',
|
1091
|
61 => '61',
|
1092
|
62 => '62',
|
1093
|
);
|
1094
|
$handler->display->display_options['filters']['field_tags_tid']['type'] = 'select';
|
1095
|
$handler->display->display_options['filters']['field_tags_tid']['vocabulary'] = 'tags';
|
1096
|
return $view;
|
1097
|
}
|
1098
|
|
1099
|
}
|