Explorar o código

[Finder] Fixed randomly failing tests due to the order files are read from the filesystem

Brandon Turner %!s(int64=15) %!d(string=hai) anos
pai
achega
26e4b2e2ef
Modificáronse 1 ficheiros con 9 adicións e 2 borrados
  1. 9 2
      tests/Symfony/Tests/Component/Finder/FinderTest.php

+ 9 - 2
tests/Symfony/Tests/Component/Finder/FinderTest.php

@@ -205,14 +205,21 @@ class FinderTest extends Iterator\RealIteratorTestCase
             $dirs[] = (string) $dir;
         }
 
-        $this->assertEquals($this->toAbsolute(array('foo', 'toto')), $dirs, 'implements the \IteratorAggregate interface');
+        $expected = $this->toAbsolute(array('foo', 'toto'));
+
+        sort($dirs);
+        sort($expected);
+
+        $this->assertEquals($expected, $dirs, 'implements the \IteratorAggregate interface');
 
         $finder = new Finder();
         $this->assertEquals(2, iterator_count($finder->directories()->in(self::$tmpDir)), 'implements the \IteratorAggregate interface');
 
         $finder = new Finder();
         $a = iterator_to_array($finder->directories()->in(self::$tmpDir));
-        $this->assertEquals($this->toAbsolute(array('foo', 'toto')), array_values(array_map(function ($a) { return (string) $a; }, $a)), 'implements the \IteratorAggregate interface');
+        $a = array_values(array_map(function ($a) { return (string) $a; }, $a));
+        sort($a);
+        $this->assertEquals($expected, $a, 'implements the \IteratorAggregate interface');
     }
 
     protected function toAbsolute($files)