/**
  * @dataProvider getTestData
  */
 public function testTest($test, $match, $noMatch)
 {
     $c = new NumberComparator($test);
     foreach ($match as $m) {
         $this->assertTrue($c->test($m), '->test() tests a string against the expression');
     }
     foreach ($noMatch as $m) {
         $this->assertFalse($c->test($m), '->test() tests a string against the expression');
     }
 }
Exemplo n.º 2
0
 /**
  * Adds tests for file sizes.
  *
  * $collection->filterBySize('> 10K');
  * $collection->filterBySize('<= 1Ki');
  * $collection->filterBySize(4);
  *
  * @param string $size A size range string
  *
  * @return FilesCollection
  *
  * @see NumberComparator
  */
 public function size($size)
 {
     $comparator = new NumberComparator($size);
     return $this->filter(function (SplFileInfo $file) use($comparator) {
         return $comparator->test($file->getSize());
     });
 }