1 views_handler_sort_date.test protected ViewsHandlerSortDateTest::expectedResultSet($granularity, $reverse = TRUE)

File

core/modules/views/tests/handlers/views_handler_sort_date.test, line 21
Definition of ViewsHandlerSortDateTest.

Class

ViewsHandlerSortDateTest
Tests for core views_handler_sort_date handler.

Code

protected function expectedResultSet($granularity, $reverse = TRUE) {
  $expected = array();
  if (!$reverse) {
    switch ($granularity) {
      case 'second':
        $expected = array(
          array('name' => 'John'),
          array('name' => 'Paul'),
          array('name' => 'Meredith'),
          array('name' => 'Ringo'),
          array('name' => 'George'),
        );
        break;
      case 'minute':
        $expected = array(
          array('name' => 'John'),
          array('name' => 'Paul'),
          array('name' => 'Ringo'),
          array('name' => 'Meredith'),
          array('name' => 'George'),
        );
        break;
      case 'hour':
        $expected = array(
          array('name' => 'John'),
          array('name' => 'Ringo'),
          array('name' => 'Paul'),
          array('name' => 'Meredith'),
          array('name' => 'George'),
        );
        break;
      case 'day':
        $expected = array(
          array('name' => 'John'),
          array('name' => 'Ringo'),
          array('name' => 'Paul'),
          array('name' => 'Meredith'),
          array('name' => 'George'),
        );
        break;
      case 'month':
        $expected = array(
          array('name' => 'John'),
          array('name' => 'George'),
          array('name' => 'Ringo'),
          array('name' => 'Paul'),
          array('name' => 'Meredith'),
        );
        break;
      case 'year':
        $expected = array(
          array('name' => 'John'),
          array('name' => 'George'),
          array('name' => 'Ringo'),
          array('name' => 'Paul'),
          array('name' => 'Meredith'),
        );
        break;
    }
  }
  else {
    switch ($granularity) {
      case 'second':
        $expected = array(
          array('name' => 'George'),
          array('name' => 'Ringo'),
          array('name' => 'Meredith'),
          array('name' => 'Paul'),
          array('name' => 'John'),
        );
        break;
      case 'minute':
        $expected = array(
          array('name' => 'George'),
          array('name' => 'Ringo'),
          array('name' => 'Meredith'),
          array('name' => 'Paul'),
          array('name' => 'John'),
        );
        break;
      case 'hour':
        $expected = array(
          array('name' => 'George'),
          array('name' => 'Ringo'),
          array('name' => 'Paul'),
          array('name' => 'Meredith'),
          array('name' => 'John'),
        );
        break;
      case 'day':
        $expected = array(
          array('name' => 'George'),
          array('name' => 'John'),
          array('name' => 'Ringo'),
          array('name' => 'Paul'),
          array('name' => 'Meredith'),
        );
        break;
      case 'month':
        $expected = array(
          array('name' => 'John'),
          array('name' => 'George'),
          array('name' => 'Ringo'),
          array('name' => 'Paul'),
          array('name' => 'Meredith'),
        );
        break;
      case 'year':
        $expected = array(
          array('name' => 'John'),
          array('name' => 'George'),
          array('name' => 'Ringo'),
          array('name' => 'Paul'),
          array('name' => 'Meredith'),
        );
        break;
    }
  }

  return $expected;
}