public function testRangeCheckOnMetadata()
 {
     $table = new DataTable();
     $table->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'foo'), Row::METADATA => array('count' => 5)), array(Row::COLUMNS => array('label' => 'bar'), Row::METADATA => array('count' => 10)), array(Row::COLUMNS => array('label' => 'bar'), Row::METADATA => array('count' => 15))));
     $filter = new RangeCheck($table, 'count', 0, 10);
     $filter->filter($table);
     $this->assertEquals(array(5, 10, 10), $table->getRowsMetadata('count'));
 }
Exemple #2
0
 /**
  * @group Core
  */
 public function testRangeCheckNormalDataTableNonIntegerValues()
 {
     $table = new DataTable();
     $table->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'ask', 'count' => '3')), array(Row::COLUMNS => array('label' => 'nintendo', 'count' => 'test')), array(Row::COLUMNS => array('label' => 'test', 'count' => 0x1232)), array(Row::COLUMNS => array('label' => 'piwik', 'count' => 0x5)), array(Row::COLUMNS => array('label' => 'google', 'count' => '9test')), array(Row::COLUMNS => array('label' => 'yahoo', 'count' => 'test4'))));
     $filter = new RangeCheck($table, 'count', 3.97, 10);
     $filter->filter($table);
     $expectedOrder = array(3.97, 3.97, 10, 5, '9test', 3.97);
     $this->assertEquals($expectedOrder, $table->getColumn('count'));
 }