예제 #1
0
 /**
  * @dataProvider naturalSortDataProvider
  */
 public function testNaturalSortCompare($array, $sorted)
 {
     if (!class_exists('Collator')) {
         $this->markTestSkipped('The intl module is not available, natural sorting might not work as expected.');
         return;
     }
     $comparator = \OC\NaturalSort::getInstance();
     usort($array, array($comparator, 'compare'));
     $this->assertEquals($sorted, $array);
 }
예제 #2
0
 /**
  * Compare two strings to provide a natural sort
  * @param string $a first string to compare
  * @param string $b second string to compare
  * @return -1 if $b comes before $a, 1 if $a comes before $b
  * or 0 if the strings are identical
  * @since 7.0.0
  */
 public static function naturalSortCompare($a, $b)
 {
     return \OC\NaturalSort::getInstance()->compare($a, $b);
 }
예제 #3
0
 /**
  * @dataProvider naturalSortDataProvider
  */
 public function testNaturalSortCompare($array, $sorted)
 {
     $comparator = \OC\NaturalSort::getInstance();
     usort($array, array($comparator, 'compare'));
     $this->assertEquals($sorted, $array);
 }