You are here

public function AutoFilterTest::testSetRangeWithExistingColumns in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/AutoFilterTest.php \AutoFilterTest::testSetRangeWithExistingColumns()

File

vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/AutoFilterTest.php, line 298

Class

AutoFilterTest

Code

public function testSetRangeWithExistingColumns() {
  $expectedResult = 'G1:J512';

  //	These columns should be retained
  $columnIndexes1 = array(
    'I',
    'J',
  );
  foreach ($columnIndexes1 as $columnIndex) {
    $this->_testAutoFilterObject
      ->setColumn($columnIndex);
  }

  //	These columns should be discarded
  $columnIndexes2 = array(
    'K',
    'L',
    'M',
  );
  foreach ($columnIndexes2 as $columnIndex) {
    $this->_testAutoFilterObject
      ->setColumn($columnIndex);
  }

  //	Setters return the instance to implement the fluent interface
  $result = $this->_testAutoFilterObject
    ->setRange($expectedResult);
  $this
    ->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);

  //	Range should be correctly set
  $result = $this->_testAutoFilterObject
    ->getRange();
  $this
    ->assertEquals($expectedResult, $result);

  //	Only columns that existed in the original range and that
  //		still fall within the new range should be retained
  $result = $this->_testAutoFilterObject
    ->getColumns();
  $this
    ->assertInternalType('array', $result);
  $this
    ->assertEquals(count($columnIndexes1), count($result));
}