| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 | 
							- <?php
 
- /**
 
-  * @file
 
-  * Definition of ViewsHandlerSortTest.
 
-  */
 
- /**
 
-  * Tests for core views_handler_sort handler.
 
-  */
 
- class ViewsHandlerSortTest extends ViewsSqlTest {
 
-   public static function getInfo() {
 
-     return array(
 
-       'name' => 'Sort: generic',
 
-       'description' => 'Test the core views_handler_sort handler.',
 
-       'group' => 'Views Handlers',
 
-     );
 
-   }
 
-   /**
 
-    * Tests numeric ordering of the result set.
 
-    */
 
-   public function testNumericOrdering() {
 
-     $view = $this->getBasicView();
 
-     // Change the ordering
 
-     $view->display['default']->handler->override_option('sorts', array(
 
-       'age' => array(
 
-         'order' => 'ASC',
 
-         'id' => 'age',
 
-         'table' => 'views_test',
 
-         'field' => 'age',
 
-         'relationship' => 'none',
 
-       ),
 
-     ));
 
-     // Execute the view.
 
-     $this->executeView($view);
 
-     // Verify the result.
 
-     $this->assertEqual(count($this->dataSet()), count($view->result), t('The number of returned rows match.'));
 
-     $this->assertIdenticalResultset($view, $this->orderResultSet($this->dataSet(), 'age'), array(
 
-       'views_test_name' => 'name',
 
-       'views_test_age' => 'age',
 
-     ));
 
-     $view = $this->getBasicView();
 
-     // Reverse the ordering
 
-     $view->display['default']->handler->override_option('sorts', array(
 
-       'age' => array(
 
-         'order' => 'DESC',
 
-         'id' => 'age',
 
-         'table' => 'views_test',
 
-         'field' => 'age',
 
-         'relationship' => 'none',
 
-       ),
 
-     ));
 
-     // Execute the view.
 
-     $this->executeView($view);
 
-     // Verify the result.
 
-     $this->assertEqual(count($this->dataSet()), count($view->result), t('The number of returned rows match.'));
 
-     $this->assertIdenticalResultset($view, $this->orderResultSet($this->dataSet(), 'age', TRUE), array(
 
-       'views_test_name' => 'name',
 
-       'views_test_age' => 'age',
 
-     ));
 
-   }
 
-   /**
 
-    * Tests string ordering of the result set.
 
-    */
 
-   public function testStringOrdering() {
 
-     $view = $this->getBasicView();
 
-     // Change the ordering
 
-     $view->display['default']->handler->override_option('sorts', array(
 
-       'name' => array(
 
-         'order' => 'ASC',
 
-         'id' => 'name',
 
-         'table' => 'views_test',
 
-         'field' => 'name',
 
-         'relationship' => 'none',
 
-       ),
 
-     ));
 
-     // Execute the view.
 
-     $this->executeView($view);
 
-     // Verify the result.
 
-     $this->assertEqual(count($this->dataSet()), count($view->result), t('The number of returned rows match.'));
 
-     $this->assertIdenticalResultset($view, $this->orderResultSet($this->dataSet(), 'name'), array(
 
-       'views_test_name' => 'name',
 
-       'views_test_age' => 'age',
 
-     ));
 
-     $view = $this->getBasicView();
 
-     // Reverse the ordering
 
-     $view->display['default']->handler->override_option('sorts', array(
 
-       'name' => array(
 
-         'order' => 'DESC',
 
-         'id' => 'name',
 
-         'table' => 'views_test',
 
-         'field' => 'name',
 
-         'relationship' => 'none',
 
-       ),
 
-     ));
 
-     // Execute the view.
 
-     $this->executeView($view);
 
-     // Verify the result.
 
-     $this->assertEqual(count($this->dataSet()), count($view->result), t('The number of returned rows match.'));
 
-     $this->assertIdenticalResultset($view, $this->orderResultSet($this->dataSet(), 'name', TRUE), array(
 
-       'views_test_name' => 'name',
 
-       'views_test_age' => 'age',
 
-     ));
 
-   }
 
- }
 
 
  |