Skip to content

Commit

Permalink
Merge pull request #512 from phpro/stream-wrapper-loader-as-default
Browse files Browse the repository at this point in the history
Update loader in CodeGeneratorEngineFactory
  • Loading branch information
veewee authored Apr 26, 2024
2 parents 7b7cd0e + 5209feb commit 05bded4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Phpro/SoapClient/Soap/CodeGeneratorEngineFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace Phpro\SoapClient\Soap;

use Http\Discovery\Psr18ClientDiscovery;
use Phpro\SoapClient\Soap\ExtSoap\Metadata\Manipulators\DuplicateTypes\IntersectDuplicateTypesStrategy;
use Phpro\SoapClient\Soap\Metadata\MetadataFactory;
use Phpro\SoapClient\Soap\Metadata\MetadataOptions;
Expand All @@ -12,8 +11,8 @@
use Soap\Engine\NoopTransport;
use Soap\Engine\PartialDriver;
use Soap\Engine\SimpleEngine;
use Soap\Psr18Transport\Wsdl\Psr18Loader;
use Soap\Wsdl\Loader\FlatteningLoader;
use Soap\Wsdl\Loader\StreamWrapperLoader;
use Soap\Wsdl\Loader\WsdlLoader;
use Soap\WsdlReader\Locator\ServiceSelectionCriteria;
use Soap\WsdlReader\Metadata\Wsdl1MetadataProvider;
Expand All @@ -33,7 +32,7 @@ public static function create(
?SoapVersion $preferredSoapVersion = null,
?ParserContext $parserContext = null,
): Engine {
$loader ??= new FlatteningLoader(Psr18Loader::createForClient(Psr18ClientDiscovery::find()));
$loader ??= new FlatteningLoader(new StreamWrapperLoader());
$metadataOptions ??= MetadataOptions::empty()->withTypesManipulator(
// Ext-soap is not able to work with duplicate types (see FAQ)
// Therefore, we decided to combine all duplicate types into 1 big intersected type by default instead.
Expand Down
16 changes: 16 additions & 0 deletions test/Phpro/SoapClient/Soap/CodeGeneratorEngineFactoryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Phpro\SoapClient\Soap;

use PHPUnit\Framework\TestCase;
use Soap\Engine\Engine;
use Soap\Engine\Metadata\Metadata;

class CodeGeneratorEngineFactoryTest extends TestCase
{
public function test_it_loads_from_filesystem(): void
{
$engine = CodeGeneratorEngineFactory::create(__DIR__ . '/../../../fixtures/wsdl/functional/calculator.wsdl');
self::assertInstanceOf(Metadata::class, $engine->getMetadata());
}
}

0 comments on commit 05bded4

Please sign in to comment.