Skip to content

Commit 9171280

Browse files
Added test for 'toAbsolutePath' with include path
1 parent 2151dda commit 9171280

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

tests/phpbu/Util/CliTest.php

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,9 @@ public function testDetectCmdFail()
3838
*/
3939
public function testDetectCmdFailWithPath()
4040
{
41-
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
42-
// can't be tested on windows system
43-
$this->assertTrue(true);
44-
} else {
45-
// assume ls should be there
46-
$cmd = Cli::detectCmdLocation('someStupidCommand', '/tmp');
47-
$this->assertFalse(true, $cmd . ' should not be found');
48-
}
41+
// assume ls should be there
42+
$cmd = Cli::detectCmdLocation('someStupidCommand', '/tmp');
43+
$this->assertFalse(true, $cmd . ' should not be found');
4944
}
5045

5146
/**
@@ -163,6 +158,39 @@ public function providerWindowsPaths()
163158
);
164159
}
165160

161+
/**
162+
* Tests Cli::toAbsolutePath
163+
*/
164+
public function testToAbsolutePathWIthIncludePath()
165+
{
166+
$filesDir = realpath(__DIR__ . '/../../_files/conf');
167+
set_include_path(get_include_path() . PATH_SEPARATOR . $filesDir);
168+
$res = Cli::toAbsolutePath('config-valid.xml', '', true);
169+
170+
171+
$this->assertEquals($filesDir . '/config-valid.xml', $res);
172+
}
173+
174+
/**
175+
* Tests Cli::registerBase
176+
*
177+
* @expectedException \RuntimeException
178+
*/
179+
public function testRegisterBaseNotAbsolute()
180+
{
181+
Cli::registerBase('name', './foo');
182+
}
183+
184+
/**
185+
* Tests Cli::registerBase
186+
*
187+
* @expectedException \RuntimeException
188+
*/
189+
public function testGetBaseNotRegistered()
190+
{
191+
Cli::getBase('fooish');
192+
}
193+
166194
/**
167195
* Tests Cli::removeDir
168196
*/

0 commit comments

Comments
 (0)