@@ -10,23 +10,29 @@ class PathInvokableTest extends PHPUnit_Framework_TestCase
10
10
* @var PathInvokable
11
11
*/
12
12
protected $ pathService ;
13
+ protected $ isWindows = false ;
13
14
14
15
public function setUp ()
15
16
{
16
17
$ this ->pathService = new PathInvokable ();
18
+ if (strtoupper (substr (PHP_OS , 0 , 3 )) === 'WIN ' ) {
19
+ $ this ->isWindows = true ;
20
+ }
17
21
}
18
22
19
23
/**
20
24
* Tests to see if the absolute path resolver functions correctly on most systems
21
25
*/
22
26
public function testGetAbsolute ()
23
27
{
24
- $ this ->assertEquals ($ this ->pathService ->getAbsolute ('/tmp ' ), '/tmp ' );
25
- $ this ->assertEquals ($ this ->pathService ->getAbsolute ('tmp/a/b ' ), getcwd ().'/tmp/a/b ' );
26
-
27
- $ this ->pathService ->setWindows (true );
28
- //only this test passes on windows, the two above and the other below don't.
29
- $ this ->assertEquals ($ this ->pathService ->getAbsolute ('E: \\tmp ' ), 'E: \\tmp ' );
30
- $ this ->assertEquals ($ this ->pathService ->getAbsolute ('tmp \\' ), getcwd ().DIRECTORY_SEPARATOR .'tmp \\' );
28
+ if ($ this ->isWindows ) {
29
+ $ this ->pathService ->setWindows (true );
30
+ //only this test passes on windows, the two above and the other below don't.
31
+ $ this ->assertEquals ($ this ->pathService ->getAbsolute ('E: \\tmp ' ), 'E: \\tmp ' );
32
+ $ this ->assertEquals ($ this ->pathService ->getAbsolute ('tmp \\' ), getcwd ().DIRECTORY_SEPARATOR .'tmp \\' );
33
+ } else {
34
+ $ this ->assertEquals ($ this ->pathService ->getAbsolute ('/tmp ' ), '/tmp ' );
35
+ $ this ->assertEquals ($ this ->pathService ->getAbsolute ('tmp/a/b ' ), getcwd ().'/tmp/a/b ' );
36
+ }
31
37
}
32
38
}
0 commit comments