You are here

public function ExportDataTest::testHideKeys in Loft Data Grids 6.2

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

File

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

Class

ExportDataTest

Namespace

AKlump\LoftDataGrids

Code

public function testHideKeys() {
  $obj = $this->obj;
  $obj
    ->setPage(0);
  $control = array(
    0 => array(
      0 => array(
        'Name' => 'Aaron',
        'Age' => 39,
      ),
      1 => array(
        'Name' => 'Hillary',
        'Age' => 37,
      ),
      2 => array(
        'Name' => 'Maia',
        'Age' => 7,
      ),
    ),
    1 => array(
      0 => array(
        'Color' => 'Black',
        'Make' => 'Subaru',
      ),
      1 => array(
        'Color' => 'White',
        'Make' => 'Hyundai',
      ),
    ),
  );
  $this
    ->assertSame($control, $obj
    ->get());
  $return = $obj
    ->hideKeys('Name');
  $this
    ->assertInstanceOf('AKlump\\LoftDataGrids\\ExportData', $return);
  $control = array(
    0 => array(
      0 => array(
        'Age' => 39,
      ),
      1 => array(
        'Age' => 37,
      ),
      2 => array(
        'Age' => 7,
      ),
    ),
    1 => array(
      0 => array(
        'Color' => 'Black',
        'Make' => 'Subaru',
      ),
      1 => array(
        'Color' => 'White',
        'Make' => 'Hyundai',
      ),
    ),
  );
  $this
    ->assertSame($control, $obj
    ->get());
  $control = array(
    0 => array(
      0 => array(),
      1 => array(),
      2 => array(),
    ),
    1 => array(
      0 => array(
        'Color' => 'Black',
        'Make' => 'Subaru',
      ),
      1 => array(
        'Color' => 'White',
        'Make' => 'Hyundai',
      ),
    ),
  );
  $obj
    ->hideKeys(TRUE);
  $this
    ->assertSame($control, $obj
    ->get());
  $control = array(
    0 => array(
      0 => array(
        'Name' => 'Aaron',
        'Age' => 39,
      ),
      1 => array(
        'Name' => 'Hillary',
        'Age' => 37,
      ),
      2 => array(
        'Name' => 'Maia',
        'Age' => 7,
      ),
    ),
    1 => array(
      0 => array(
        'Color' => 'Black',
        'Make' => 'Subaru',
      ),
      1 => array(
        'Color' => 'White',
        'Make' => 'Hyundai',
      ),
    ),
  );
  $obj
    ->hideKeys(FALSE);
  $this
    ->assertSame($control, $obj
    ->get());
}