From 7daf876d704e312868b88b38cd9fce111583d4b6 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 29 Mar 2014 18:10:11 +0100 Subject: [PATCH] Fix test because the order of filesystem iteration is non deterministic --- .../Composer/Test/Autoload/ClassMapGeneratorTest.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php index 1a855558f..c191c7f1d 100644 --- a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php +++ b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php @@ -115,12 +115,22 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase $a = realpath(__DIR__.'/Fixtures/Ambiguous/A.php'); $b = realpath(__DIR__.'/Fixtures/Ambiguous/other/A.php'); + $msg = ''; $io->expects($this->once()) ->method('write') - ->with('Warning: Ambiguous class resolution, "A" was found in both "'.$a.'" and "'.$b.'", the first will be used.'); + ->will($this->returnCallback(function ($text) use (&$msg) { + $msg = $text; + })); + + $messages = array( + 'Warning: Ambiguous class resolution, "A" was found in both "'.$a.'" and "'.$b.'", the first will be used.', + 'Warning: Ambiguous class resolution, "A" was found in both "'.$b.'" and "'.$a.'", the first will be used.', + ); ClassMapGenerator::createMap($finder, null, $io); + + $this->assertTrue(in_array($msg, $messages, true), $msg.' not found in expected messages ('.var_export($messages, true).')'); } /**