You are here

public function ExportDataTest::testLocations in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/aklump/loft_data_grids/tests/ExportDataTest.php \AKlump\LoftDataGrids\ExportDataTest::testLocations()

File

vendor/aklump/loft_data_grids/tests/phpunit/ExportDataTest.php, line 232
Tests for the ExportData class

Class

ExportDataTest

Namespace

AKlump\LoftDataGrids

Code

public function testLocations() {
  $obj = $this->obj;

  // This is null because page 2 doesn't have a Name column
  $this
    ->assertNull($obj
    ->getCurrent('Name'));

  // This is null because we're on row 2
  $this
    ->assertNull($obj
    ->getCurrent('Color'));
  $return = $obj
    ->setPointer(1)
    ->getCurrent('Color');
  $this
    ->assertSame('White', $return);
  $obj
    ->storeLocation('cars');
  $return = $obj
    ->gotoLocation('start');
  $this
    ->assertInstanceOf('AKlump\\LoftDataGrids\\ExportData', $return);
  $this
    ->assertSame('Hillary', $obj
    ->getCurrent('Name'));
  $this
    ->assertEquals(0, $obj
    ->getCurrentPageId());
  $this
    ->assertEquals(1, $obj
    ->getPointer());
  $subject = array(
    'start' => array(
      'page' => 0,
      'pointers' => array(
        0 => 1,
        1 => 0,
      ),
    ),
    'cars' => array(
      'page' => 1,
      'pointers' => array(
        0 => 1,
        1 => 1,
      ),
    ),
  );
  $this
    ->assertSame($subject, $locs = $obj
    ->getLocations());
  $copy = new ExportData();
  $copy
    ->setLocations($locs);
  $this
    ->assertSame($subject, $copy
    ->getLocations());
}