| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: views_query.test,v 1.1.2.1 2009/11/02 22:01:27 merlinofchaos Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 81 |
} |
} |
| 82 |
} |
} |
| 83 |
|
|
| 84 |
|
abstract class ViewsSqlTest extends ViewsTestCase { |
|
/** |
|
|
* Basic test class for Views query builder tests. |
|
|
*/ |
|
|
class ViewsBasicTest extends ViewsTestCase { |
|
|
public static function getInfo() { |
|
|
return array( |
|
|
'name' => t('Basic query test'), |
|
|
'description' => t('A basic query test for Views.'), |
|
|
'group' => t('Views') |
|
|
); |
|
|
} |
|
| 85 |
|
|
| 86 |
protected function setUp() { |
protected function setUp() { |
| 87 |
parent::setUp('views', 'views_test'); |
parent::setUp('views', 'views_test'); |
| 127 |
), |
), |
| 128 |
); |
); |
| 129 |
} |
} |
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
|
| 133 |
|
/** |
| 134 |
|
* Basic test class for Views query builder tests. |
| 135 |
|
*/ |
| 136 |
|
class ViewsBasicTest extends ViewsSqlTest { |
| 137 |
|
public static function getInfo() { |
| 138 |
|
return array( |
| 139 |
|
'name' => t('Basic query test'), |
| 140 |
|
'description' => t('A basic query test for Views.'), |
| 141 |
|
'group' => t('Views') |
| 142 |
|
); |
| 143 |
|
} |
| 144 |
|
|
| 145 |
/** |
/** |
| 146 |
* Build and return a basic view of the views_test table. |
* Build and return a basic view of the views_test table. |
| 458 |
/** |
/** |
| 459 |
* Basic test for pluggable caching. |
* Basic test for pluggable caching. |
| 460 |
*/ |
*/ |
| 461 |
class ViewsCacheTest extends ViewsTestCase { |
class ViewsCacheTest extends ViewsSqlTest { |
| 462 |
public static function getInfo() { |
public static function getInfo() { |
| 463 |
return array( |
return array( |
| 464 |
'name' => t('Pluggable caching test'), |
'name' => t('Pluggable caching test'), |
| 467 |
); |
); |
| 468 |
} |
} |
| 469 |
|
|
|
protected function setUp() { |
|
|
parent::setUp('views', 'views_test'); |
|
|
|
|
|
// Load the test dataset. |
|
|
$query = db_insert('views_test') |
|
|
->fields(array('name', 'age', 'job')); |
|
|
foreach ($this->testDataSet() as $record) { |
|
|
$query->values($record); |
|
|
} |
|
|
$query->execute(); |
|
|
} |
|
|
|
|
|
/** |
|
|
* A very simple test dataset. |
|
|
*/ |
|
|
protected function testDataSet() { |
|
|
return array( |
|
|
array( |
|
|
'name' => 'John', |
|
|
'age' => 25, |
|
|
'job' => 'Singer', |
|
|
), |
|
|
array( |
|
|
'name' => 'George', |
|
|
'age' => 27, |
|
|
'job' => 'Singer', |
|
|
), |
|
|
array( |
|
|
'name' => 'Ringo', |
|
|
'age' => 28, |
|
|
'job' => 'Drummer', |
|
|
), |
|
|
array( |
|
|
'name' => 'Paul', |
|
|
'age' => 26, |
|
|
'job' => 'Songwriter', |
|
|
), |
|
|
array( |
|
|
'name' => 'Meredith', |
|
|
'age' => 30, |
|
|
'job' => 'Speaker', |
|
|
), |
|
|
); |
|
|
} |
|
|
|
|
|
|
|
| 470 |
/** |
/** |
| 471 |
* Build and return a basic view of the views_test table. |
* Build and return a basic view of the views_test table. |
| 472 |
*/ |
*/ |