You are here

public function ExportDataTest::testHideKeys 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::testHideKeys()

File

vendor/aklump/loft_data_grids/tests/phpunit/ExportDataTest.php, line 67
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());
}