示例#1
0
 public function test_sortFilesDescByPathLength_shouldNotChangeOrder_IfAllHaveSameLength()
 {
     $input = array('xyz/1.gif', 'x/xyz.gif', 'xxyyzzgg');
     $result = Filesystem::sortFilesDescByPathLength($input);
     if (SystemTestCase::isPhp7orLater()) {
         $input = array('x/xyz.gif', 'xyz/1.gif', 'xxyyzzgg');
     }
     $this->assertEquals($input, $result);
 }
示例#2
0
 public function testOrderByShouldListAllHighestPositiveValuesFirstThenAllNegativeValuesLowestFirst()
 {
     $this->table->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'pos1', 'growth' => 12)), array(Row::COLUMNS => array('label' => 'pos2', 'growth' => 7)), array(Row::COLUMNS => array('label' => 'neg1', 'growth' => -9)), array(Row::COLUMNS => array('label' => 'pos3', 'growth' => 10)), array(Row::COLUMNS => array('label' => 'neg2', 'growth' => -11)), array(Row::COLUMNS => array('label' => 'neg3', 'growth' => -13)), array(Row::COLUMNS => array('label' => 'pos4', 'growth' => 9)), array(Row::COLUMNS => array('label' => 'pos5', 'growth' => 10)), array(Row::COLUMNS => array('label' => 'pos6', 'growth' => 0)), array(Row::COLUMNS => array('label' => 'neg4', 'growth' => -7)), array(Row::COLUMNS => array('label' => 'neg5', 'growth' => -8))));
     $this->applyOrderByFilter();
     if (SystemTestCase::isPhp7orLater()) {
         $this->assertOrder(array('pos1', 'pos3', 'pos5', 'pos4', 'pos2', 'pos6', 'neg3', 'neg2', 'neg1', 'neg5', 'neg4'));
     } else {
         $this->assertOrder(array('pos1', 'pos5', 'pos3', 'pos4', 'pos2', 'pos6', 'neg3', 'neg2', 'neg1', 'neg5', 'neg4'));
     }
 }