Check that the directory cache exists
This commit is contained in:
@ -36,11 +36,19 @@ class SoapRequestTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testSetDirectory()
|
||||
{
|
||||
Cache::setDirectory('/foo');
|
||||
$this->assertEquals('/foo', Cache::getDirectory());
|
||||
\vfsStream::setup('Fixtures');
|
||||
|
||||
Cache::setDirectory('/bar');
|
||||
$this->assertEquals('/bar', Cache::getDirectory());
|
||||
$this->assertFalse(\vfsStreamWrapper::getRoot()->hasChild('foo'));
|
||||
$dir = \vfsStream::url('Fixtures/foo');
|
||||
Cache::setDirectory($dir);
|
||||
$this->assertEquals($dir, Cache::getDirectory());
|
||||
$this->assertTrue(\vfsStreamWrapper::getRoot()->hasChild('foo'));
|
||||
|
||||
$this->assertFalse(\vfsStreamWrapper::getRoot()->hasChild('bar'));
|
||||
$dir = \vfsStream::url('Fixtures/bar');
|
||||
Cache::setDirectory($dir);
|
||||
$this->assertEquals($dir, Cache::getDirectory());
|
||||
$this->assertTrue(\vfsStreamWrapper::getRoot()->hasChild('bar'));
|
||||
}
|
||||
|
||||
public function testSetLifetime()
|
||||
|
@ -11,11 +11,18 @@ spl_autoload_register(function($class) {
|
||||
|
||||
return true;
|
||||
}
|
||||
} else if (0 === strpos($class, 'BeSimple\SoapCommon\\')) {
|
||||
} elseif (0 === strpos($class, 'BeSimple\SoapCommon\\')) {
|
||||
$path = __DIR__.'/../src/'.($class = strtr($class, '\\', '/')).'.php';
|
||||
if (file_exists($path) && is_readable($path)) {
|
||||
require_once $path;
|
||||
|
||||
return true;
|
||||
}
|
||||
} elseif (0 === strpos($class, 'vfsStream')) {
|
||||
$path = __DIR__.'/../vendor/vfsStream/src/main/php/org/bovigo/vfs/'.$class.'.php';
|
||||
if (file_exists($path) && is_readable($path)) {
|
||||
require_once $path;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user