Fixed tests

This commit is contained in:
Francis Besset 2013-07-25 09:29:22 +02:00
parent fe4e821ff5
commit 0c5d2c54ab
6 changed files with 39 additions and 8 deletions

View File

@ -38,6 +38,7 @@
"require-dev": {
"ext-mcrypt": "*",
"mikey179/vfsStream": "dev-master",
"symfony/filesystem": ">=2.3,<2.4-dev",
"symfony/process": ">=2.3,<2.4-dev"
},
"autoload": {

View File

@ -1,3 +1,4 @@
vendor/
composer.lock
phpunit.xml
Tests/Fixtures/build_include/

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<wsdl:documentation>wsdlincludetest</wsdl:documentation>
<wsdl:include location="http://localhost:8000/wsdl_include.wsdl"/>
<wsdl:include location="http://%location%/wsdl_include.wsdl"/>
</wsdl:definitions>

View File

@ -3,7 +3,7 @@
<wsdl:documentation>xsdinctest</wsdl:documentation>
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://test.sample">
<xs:include schemaLocation="http://localhost:8000/type_include.xsd"/>
<xs:include schemaLocation="http://%location%/type_include.xsd"/>
</xs:schema>
</wsdl:types>
</wsdl:definitions>

View File

@ -15,6 +15,7 @@ namespace BeSimple\SoapClient\Tests;
use BeSimple\SoapClient\WsdlDownloader;
use BeSimple\SoapCommon\Cache;
use BeSimple\SoapClient\Curl;
use Symfony\Component\Filesystem\Filesystem;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamWrapper;
@ -24,6 +25,10 @@ use org\bovigo\vfs\vfsStreamWrapper;
*/
class WsdlDownloaderTest extends AbstractWebserverTest
{
static protected $filesystem;
static protected $fixturesPath;
/**
* @dataProvider provideDownload
*/
@ -49,7 +54,7 @@ class WsdlDownloaderTest extends AbstractWebserverTest
{
return array(
array(
__DIR__.DIRECTORY_SEPARATOR.'Fixtures/xsdinclude/xsdinctest_absolute.xml',
__DIR__.DIRECTORY_SEPARATOR.'Fixtures/build_include/xsdinctest_absolute.xml',
'%s/wsdl_[a-f0-9]{32}\.cache',
2,
),
@ -59,7 +64,7 @@ class WsdlDownloaderTest extends AbstractWebserverTest
1,
),
array(
sprintf('http://localhost:%d/xsdinclude/xsdinctest_absolute.xml', WEBSERVER_PORT),
sprintf('http://localhost:%d/build_include/xsdinctest_absolute.xml', WEBSERVER_PORT),
'%s/wsdl_[a-f0-9]{32}\.cache',
2,
),
@ -124,12 +129,12 @@ class WsdlDownloaderTest extends AbstractWebserverTest
public function provideResolveWsdlIncludes()
{
$remoteUrlAbsolute = sprintf('http://localhost:%d/wsdlinclude/wsdlinctest_absolute.xml', WEBSERVER_PORT);
$remoteUrlAbsolute = sprintf('http://localhost:%d/build_include/wsdlinctest_absolute.xml', WEBSERVER_PORT);
$remoteUrlRelative = sprintf('http://localhost:%d/wsdlinclude/wsdlinctest_relative.xml', WEBSERVER_PORT);
return array(
array(
__DIR__.DIRECTORY_SEPARATOR.'Fixtures/wsdlinclude/wsdlinctest_absolute.xml',
__DIR__.DIRECTORY_SEPARATOR.'Fixtures/build_include/wsdlinctest_absolute.xml',
'%s/cache_local_absolute.xml',
null,
'%s/wsdl_[a-f0-9]{32}.cache',
@ -187,12 +192,12 @@ class WsdlDownloaderTest extends AbstractWebserverTest
public function provideResolveXsdIncludes()
{
$remoteUrlAbsolute = sprintf('http://localhost:%d/xsdinclude/xsdinctest_absolute.xml', WEBSERVER_PORT);
$remoteUrlAbsolute = sprintf('http://localhost:%d/build_include/xsdinctest_absolute.xml', WEBSERVER_PORT);
$remoteUrlRelative = sprintf('http://localhost:%d/xsdinclude/xsdinctest_relative.xml', WEBSERVER_PORT);
return array(
array(
__DIR__.DIRECTORY_SEPARATOR.'Fixtures/xsdinclude/xsdinctest_absolute.xml',
__DIR__.DIRECTORY_SEPARATOR.'Fixtures/build_include/xsdinctest_absolute.xml',
'%s/cache_local_absolute.xml',
null,
'%s/wsdl_[a-f0-9]{32}\.cache',
@ -254,4 +259,27 @@ class WsdlDownloaderTest extends AbstractWebserverTest
$this->assertEquals('http://localhost/test', $m->invoke($wsdlDownloader, 'http://localhost/sub/sub/sub', '../../../test'));
$this->assertEquals('http://localhost/test', $m->invoke($wsdlDownloader, 'http://localhost/sub/sub/sub/', '../../../test'));
}
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
self::$filesystem = new Filesystem();
self::$fixturesPath = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR;
self::$filesystem->mkdir(self::$fixturesPath.'build_include');
foreach (array('wsdlinclude/wsdlinctest_absolute.xml', 'xsdinclude/xsdinctest_absolute.xml') as $file) {
$content = file_get_contents(self::$fixturesPath.$file);
$content = preg_replace('#'.preg_quote('%location%').'#', sprintf('localhost:%d', WEBSERVER_PORT), $content);
self::$filesystem->dumpFile(self::$fixturesPath.'build_include'.DIRECTORY_SEPARATOR.pathinfo($file, PATHINFO_BASENAME), $content);
}
}
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
self::$filesystem->remove(self::$fixturesPath.'build_include');
}
}

View File

@ -28,6 +28,7 @@
},
"require-dev": {
"mikey179/vfsStream": "dev-master",
"symfony/filesystem": ">=2.3,<2.4-dev",
"symfony/process": ">=2.3,<2.4-dev"
},
"autoload": {