You are here

class AccessingDataTest in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/aklump/loft_data_grids/tests/phpunit/AccessingDataTest.php \AKlump\LoftDataGrids\AccessingDataTest

Hierarchy

  • class \AKlump\LoftDataGrids\AccessingDataTest extends \AKlump\LoftDataGrids\PHPUnit_Framework_TestCase

Expanded class hierarchy of AccessingDataTest

Related topics

File

vendor/aklump/loft_data_grids/tests/AccessingDataTest.php, line 13
Tests for the ExportData class data access.

Namespace

AKlump\LoftDataGrids
View source
class AccessingDataTest extends \PHPUnit_Framework_TestCase {
  public function testGetRows() {
    $obj = new ExportData();
    $this
      ->assertSame(array(), $obj
      ->getRows());
    $obj
      ->add('name', 'bob')
      ->next();
    $obj
      ->add('name', 'charlie')
      ->next();
    $obj
      ->add('name', 'dave')
      ->next();
    $control = array(
      0 => array(
        'name' => 'bob',
      ),
      1 => array(
        'name' => 'charlie',
      ),
      2 => array(
        'name' => 'dave',
      ),
    );
    $this
      ->assertSame($control, $obj
      ->getRows());
    $this
      ->assertSame('dave', $obj
      ->setPointer(2)
      ->getValue('name'));
  }
  public function testGetCount() {
    $obj = new ExportData();
    $this
      ->assertSame(0, $obj
      ->getCount());
    $obj
      ->add('name', 'bob')
      ->next();
    $obj
      ->add('name', 'charlie')
      ->next();
    $obj
      ->add('name', 'dave')
      ->next();
    $this
      ->assertSame(3, $obj
      ->getCount());
  }
  public function testGetValue() {
    $obj = new ExportData();
    $obj
      ->add('Name', 'Aaron')
      ->add('Age', 39)
      ->next();
    $obj
      ->add('Name', 'Hillary')
      ->add('Age', 37)
      ->next();
    $obj
      ->add('Name', 'Maia')
      ->add('Age', 7)
      ->next();
    $obj
      ->setPage(1);
    $obj
      ->add('Color', 'Black')
      ->add('Make', 'Subaru')
      ->next();
    $obj
      ->add('Color', 'White')
      ->add('Make', 'Hyundai')
      ->next();
    $return = $obj
      ->setPage(0)
      ->setPointer(0)
      ->getValue('Age');
    $this
      ->assertSame(39, $return);
    $return = $obj
      ->setPage(0)
      ->getValue('Name');
    $this
      ->assertSame('Aaron', $return);
    $return = $obj
      ->setPage(1)
      ->setPointer(0)
      ->getValue('Color');
    $this
      ->assertSame('Black', $return);
    $return = $obj
      ->getValue('Make');
    $this
      ->assertSame('Subaru', $return);
  }

}

Members