Used BeSimple\SoapCommon\Cache to define the cache strategy
This commit is contained in:
parent
fd162d8ca6
commit
aaca80a262
|
@ -0,0 +1 @@
|
|||
vendor
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
namespace BeSimple\SoapClient\Soap;
|
||||
|
||||
use BeSimple\SoapCommon\Cache;
|
||||
|
||||
/**
|
||||
* @author Francis Besset <francis.besset@gmail.com>
|
||||
*/
|
||||
|
@ -33,8 +35,8 @@ class SoapClient
|
|||
public function setOptions(array $options)
|
||||
{
|
||||
$this->options = array(
|
||||
'cache_dir' => null,
|
||||
'debug' => false,
|
||||
'debug' => false,
|
||||
'cache_wsdl' => null,
|
||||
);
|
||||
|
||||
// check option names and live merge, if errors are encountered Exception will be thrown
|
||||
|
@ -135,7 +137,11 @@ class SoapClient
|
|||
{
|
||||
$options = array();
|
||||
|
||||
$options['cache_wsdl'] = $this->options['debug'] ? WSDL_CACHE_NONE : WSDL_CACHE_DISK;
|
||||
if (null === $this->options['cache_wsdl']) {
|
||||
$this->options['cache_wsdl'] = Cache::getType();
|
||||
}
|
||||
|
||||
$options['cache_wsdl'] = $this->options['cache_wsdl'];
|
||||
$options['trace'] = $this->options['debug'];
|
||||
|
||||
return $options;
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the BeSimpleSoapClient.
|
||||
*
|
||||
* (c) Christian Kerl <christian-kerl@web.de>
|
||||
* (c) Francis Besset <francis.besset@gmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
CAUTION: This file installs the dependencies needed to run the BeSimpleSoapClient test suite.
|
||||
|
||||
https://github.com/BeSimple/BeSimpleSoapClient
|
||||
|
||||
*/
|
||||
|
||||
if (!is_dir($vendorDir = dirname(__FILE__).'/vendor')) {
|
||||
mkdir($vendorDir, 0777, true);
|
||||
}
|
||||
|
||||
$deps = array(
|
||||
array('besimple-soapcommon', 'http://github.com/BeSimple/BeSimpleSoapCommon.git', 'origin/HEAD'),
|
||||
);
|
||||
|
||||
foreach ($deps as $dep) {
|
||||
list($name, $url, $rev) = $dep;
|
||||
|
||||
echo "> Installing/Updating $name\n";
|
||||
|
||||
$installDir = $vendorDir.'/'.$name;
|
||||
if (!is_dir($installDir)) {
|
||||
system(sprintf('git clone %s %s', escapeshellarg($url), escapeshellarg($installDir)));
|
||||
}
|
||||
|
||||
system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
|
||||
}
|
Loading…
Reference in New Issue