Used BeSimple\SoapCommon\Cache to define the cache strategy

This commit is contained in:
Francis Besset
2011-09-04 00:36:24 +02:00
parent fd162d8ca6
commit aaca80a262
5 changed files with 65 additions and 6 deletions

View File

@ -12,6 +12,7 @@
namespace BeSimple\Tests\SoapClient\Soap;
use BeSimple\SoapCommon\Cache;
use BeSimple\SoapClient\Soap\SoapClient;
class SoapClientTest extends \PHPUnit_Framework_TestCase
@ -20,8 +21,8 @@ class SoapClientTest extends \PHPUnit_Framework_TestCase
{
$soapClient = new SoapClient('foo.wsdl');
$options = array(
'cache_dir' => '/tmp',
'debug' => true,
'cache_wsdl' => Cache::TYPE_DISK_MEMORY,
'debug' => true,
);
$soapClient->setOptions($options);
@ -62,9 +63,12 @@ class SoapClientTest extends \PHPUnit_Framework_TestCase
public function testGetSoapOptions()
{
Cache::setType(Cache::TYPE_MEMORY);
$soapClient = new SoapClient('foo.wsdl', array('debug' => true));
$this->assertEquals(array('cache_wsdl' => Cache::getType(), 'trace' => true), $soapClient->getSoapOptions());
$this->assertEquals(array('cache_wsdl' => WSDL_CACHE_NONE, 'trace' => true), $soapClient->getSoapOptions());
$soapClient = new SoapClient('foo.wsdl', array('debug' => false, 'cache_wsdl' => Cache::TYPE_NONE));
$this->assertEquals(array('cache_wsdl' => Cache::TYPE_NONE, 'trace' => false), $soapClient->getSoapOptions());
}
public function testGetNativeSoapClient()

View File

@ -16,6 +16,13 @@ spl_autoload_register(function($class) {
if (file_exists($path) && is_readable($path)) {
require_once $path;
return true;
}
} else if (0 === strpos($class, 'BeSimple\SoapCommon\\')) {
$path = __DIR__.'/../vendor/besimple-soapcommon/src/'.($class = strtr($class, '\\', '/')).'.php';
if (file_exists($path) && is_readable($path)) {
require_once $path;
return true;
}
}