/** * @param string $fixture Absolute file path, or relative path to {@link Director::baseFolder()} */ public function __construct($fixture) { if (false !== strpos($fixture, "\n")) { $this->fixtureString = $fixture; } else { if (!Director::is_absolute($fixture)) { $fixture = Director::baseFolder() . '/' . $fixture; } if (!file_exists($fixture)) { throw new InvalidArgumentException('YamlFixture::__construct(): Fixture path "' . $fixture . '" not found'); } $this->fixtureFile = $fixture; } parent::__construct(); }
/** * Tests that {@link Director::is_absolute()} works under different environment types */ public function testIsAbsolute() { $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}"); } }