From 0c0cb622ac065be659e4785d207c7b9d5e5d60fb Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sun, 17 Feb 2019 09:21:12 +0100 Subject: [PATCH] Refactor test --- src/Framework/MockObject/Generator.php | 2 +- tests/_files/{3530.xml => 3530.wsdl} | 0 .../mock-objects/generator/3530.phpt | 27 +++++++++++++++++++ .../Framework/MockObject/GeneratorTest.php | 23 ---------------- 4 files changed, 28 insertions(+), 24 deletions(-) rename tests/_files/{3530.xml => 3530.wsdl} (100%) create mode 100644 tests/end-to-end/mock-objects/generator/3530.phpt diff --git a/src/Framework/MockObject/Generator.php b/src/Framework/MockObject/Generator.php index da0543f905c..14cf9e7fef3 100644 --- a/src/Framework/MockObject/Generator.php +++ b/src/Framework/MockObject/Generator.php @@ -458,7 +458,7 @@ public function generateClassFromWsdl($wsdlFile, $className, array $methods = [] $methodsBuffer = ''; foreach ($_methods as $method) { - \preg_match_all("/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\(/", $method, $matches, \PREG_OFFSET_CAPTURE); + \preg_match_all('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\(/', $method, $matches, \PREG_OFFSET_CAPTURE); $lastFunction = \array_pop($matches[0]); $nameStart = $lastFunction[1]; $nameEnd = $nameStart + \strlen($lastFunction[0]) - 1; diff --git a/tests/_files/3530.xml b/tests/_files/3530.wsdl similarity index 100% rename from tests/_files/3530.xml rename to tests/_files/3530.wsdl diff --git a/tests/end-to-end/mock-objects/generator/3530.phpt b/tests/end-to-end/mock-objects/generator/3530.phpt new file mode 100644 index 00000000000..588a654d7c3 --- /dev/null +++ b/tests/end-to-end/mock-objects/generator/3530.phpt @@ -0,0 +1,27 @@ +--TEST-- +\PHPUnit\Framework\MockObject\Generator::generateClassFromWsdl('3530.wsdl', 'Test') +--SKIPIF-- +generateClassFromWsdl( + __DIR__ . '/../../../_files/3530.wsdl', + 'Test' +); +--EXPECTF-- +class Test extends \SoapClient +{ + public function __construct($wsdl, array $options) + { + parent::__construct('%s/3530.wsdl', $options); + } + + public function Contact_Information($Contact_Id) + { + } +} diff --git a/tests/unit/Framework/MockObject/GeneratorTest.php b/tests/unit/Framework/MockObject/GeneratorTest.php index 1c4fa8e4942..bc39b8d10aa 100644 --- a/tests/unit/Framework/MockObject/GeneratorTest.php +++ b/tests/unit/Framework/MockObject/GeneratorTest.php @@ -242,27 +242,4 @@ public function testVariadicArgumentsArePassedToMockedMethod() $mock->foo(...$arguments); } - - public function testGenerateClassFromWsdlForMultipleOutputValues() - { - $wsdlPath = TEST_FILES_PATH . '3530.xml'; - $generator = new Generator(); - $result = $generator->generateClassFromWsdl($wsdlPath, 'Test'); - - $expected = <<assertEquals($expected, $result); - } }