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": { "autoload": {
"psr-0": { "psr-0": {
"BeSimple\\SoapCommon": "BeSimple/SoapCommon/src/" "BeSimple\\SoapCommon": "src/"
} }
}, },
"target-dir": "BeSimple/SoapCommon" "target-dir": "BeSimple/SoapCommon"

View File

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

View File

@ -1,36 +1,5 @@
<?php <?php
error_reporting(E_ALL | E_STRICT); $loader = require __DIR__.'/../vendor/autoload.php';
// register silently failing autoloader $loader->add('BeSimple\Tests\SoapCommon\\', __DIR__);
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;
}
}
});