Fixed tests

This commit is contained in:
Francis Besset 2013-01-16 11:53:33 +01:00
parent 17d0652959
commit 3bd32c380d
3 changed files with 12 additions and 41 deletions

View File

@ -28,7 +28,7 @@
},
"autoload": {
"psr-0": {
"BeSimple\\SoapCommon": "BeSimple/SoapCommon/src/"
"BeSimple\\SoapCommon": "src/"
}
},
"target-dir": "BeSimple/SoapCommon"

View File

@ -13,6 +13,8 @@
namespace BeSimple\Tests\SoapCommon\Soap;
use BeSimple\SoapCommon\Cache;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamWrapper;
class SoapRequestTest extends \PHPUnit_Framework_TestCase
{
@ -48,19 +50,19 @@ class SoapRequestTest extends \PHPUnit_Framework_TestCase
public function testSetDirectory()
{
\vfsStream::setup('Fixtures');
vfsStream::setup('Fixtures');
$this->assertFalse(\vfsStreamWrapper::getRoot()->hasChild('foo'));
$dir = \vfsStream::url('Fixtures/foo');
$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->assertTrue(vfsStreamWrapper::getRoot()->hasChild('foo'));
$this->assertFalse(\vfsStreamWrapper::getRoot()->hasChild('bar'));
$dir = \vfsStream::url('Fixtures/bar');
$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'));
$this->assertTrue(vfsStreamWrapper::getRoot()->hasChild('bar'));
}
public function testSetLifetime()

View File

@ -1,36 +1,5 @@
<?php
error_reporting(E_ALL | E_STRICT);
$loader = require __DIR__.'/../vendor/autoload.php';
// register silently failing autoloader
spl_autoload_register(function($class) {
if (0 === strpos($class, 'BeSimple\Tests\\')) {
$path = __DIR__.'/'.strtr($class, '\\', '/').'.php';
if (file_exists($path) && is_readable($path)) {
require_once $path;
return true;
}
} elseif (0 === strpos($class, 'BeSimple\SoapCommon\\')) {
$path = __DIR__.'/../src/'.strtr($class, '\\', '/').'.php';
if (file_exists($path) && is_readable($path)) {
require_once $path;
return true;
}
} elseif (0 === strpos($class, 'ass\XmlSecurity\\')) {
$path = __DIR__.'/../vendor/XmlSecurity/src/'.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;
}
}
});
$loader->add('BeSimple\Tests\SoapCommon\\', __DIR__);