mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Minor cleanup of DirectorTest
This commit is contained in:
parent
3a007d52e6
commit
3c532cea0c
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace SilverStripe\Control\Tests;
|
namespace SilverStripe\Control\Tests;
|
||||||
|
|
||||||
use SilverStripe\Control\Cookie_Backend;
|
use SilverStripe\Control\Cookie_Backend;
|
||||||
@ -193,24 +194,26 @@ class DirectorTest extends SapphireTest
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that {@link Director::is_absolute()} works under different environment types
|
* Tests that {@link Director::is_absolute()} works under different environment types
|
||||||
|
* @dataProvider provideAbsolutePaths
|
||||||
*/
|
*/
|
||||||
public function testIsAbsolute()
|
public function testIsAbsolute($path, $result)
|
||||||
{
|
{
|
||||||
$expected = array (
|
$this->assertEquals($result, Director::is_absolute($path));
|
||||||
'C:/something' => true,
|
|
||||||
'd:\\' => true,
|
|
||||||
'e/' => false,
|
|
||||||
's:/directory' => true,
|
|
||||||
'/var/www' => true,
|
|
||||||
'\\Something' => true,
|
|
||||||
'something/c:' => false,
|
|
||||||
'folder' => false,
|
|
||||||
'a/c:/' => false
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($expected as $path => $result) {
|
|
||||||
$this->assertEquals(Director::is_absolute($path), $result, "Test result for $path");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function provideAbsolutePaths()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['C:/something', true],
|
||||||
|
['d:\\', true],
|
||||||
|
['e/', false],
|
||||||
|
['s:/directory', true],
|
||||||
|
['/var/www', true],
|
||||||
|
['\\Something', true],
|
||||||
|
['something/c:', false],
|
||||||
|
['folder', false],
|
||||||
|
['a/c:/', false],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsAbsoluteUrl()
|
public function testIsAbsoluteUrl()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user