Minor cleanup of DirectorTest

This commit is contained in:
Dan Hensby 2018-09-26 00:55:46 +01:00
parent 3a007d52e6
commit 3c532cea0c
No known key found for this signature in database
GPG Key ID: 3906B235643EF10B

View File

@ -1,4 +1,5 @@
<?php
namespace SilverStripe\Control\Tests;
use SilverStripe\Control\Cookie_Backend;
@ -193,24 +194,26 @@ class DirectorTest extends SapphireTest
/**
* Tests that {@link Director::is_absolute()} works under different environment types
* @dataProvider provideAbsolutePaths
*/
public function testIsAbsolute()
public function testIsAbsolute($path, $result)
{
$expected = array (
'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");
$this->assertEquals($result, Director::is_absolute($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()