Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Merge fb19916 into 03fd11a
Browse files Browse the repository at this point in the history
  • Loading branch information
sanmai committed Jun 28, 2019
2 parents 03fd11a + fb19916 commit be97b1f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -36,7 +36,7 @@
"ext-libxml": "*",
"guzzlehttp/guzzle": "^6.3",
"psr/log": "^1.0",
"sanmai/cdek-sdk-serializer": "^0.1",
"sanmai/cdek-sdk-serializer": "^0.1 || ^0.2",
"sanmai/pipeline": "^0.3.2 || ^2.0 || ^3.0.1"
},
"conflict": {},
Expand Down
3 changes: 3 additions & 0 deletions src/CdekClient.php
Expand Up @@ -206,6 +206,9 @@ public function __call(string $name, array $arguments)
/**
* @psalm-suppress InvalidReturnStatement
* @psalm-suppress InvalidReturnType
* @psalm-suppress LessSpecificReturnStatement
* @psalm-suppress ArgumentTypeCoercion
* @psalm-suppress MoreSpecificReturnType
*
* @param Request $request
* @param ResponseInterface $response
Expand Down
18 changes: 17 additions & 1 deletion tests/Serialization/TestCase.php
Expand Up @@ -35,6 +35,22 @@ abstract class TestCase extends DeserializationTestCase
{
protected function assertSameAsXML(string $xml, $request)
{
$this->assertSame($xml, $this->getSerializer()->serialize($request, Request::SERIALIZATION_XML));
$serializedXml = $this->getSerializer()->serialize($request, Request::SERIALIZATION_XML);

$serializedXml = $this->fixXmlFloats($serializedXml);

$this->assertSame($xml, $serializedXml);
}

/**
* @deprecated remove this method after updating fixtures
*/
private function fixXmlFloats(string $xml): string
{
if (!\interface_exists('\JMS\Serializer\Naming\AdvancedNamingStrategyInterface')) {
return \preg_replace('/([A-Z][a-z]+)="(\d+)\.0"/', '\1="\2"', $xml);
}

return $xml;
}
}

0 comments on commit be97b1f

Please sign in to comment.