diff --git a/composer.json b/composer.json index b468d0d..37e0100 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "symfony/routing": "If you want to use SelfAwareProfileRequestHandler" }, "require-dev": { - "phpunit/phpunit": "^9.6.13", + "phpunit/phpunit": "^10.5.20", "phpstan/phpstan": "^1.10.41", "friendsofphp/php-cs-fixer": "*", "php-parallel-lint/php-parallel-lint": "*", diff --git a/src/CXml/Model/Response/StatusResponse.php b/src/CXml/Model/Response/StatusResponse.php deleted file mode 100644 index eab11c8..0000000 --- a/src/CXml/Model/Response/StatusResponse.php +++ /dev/null @@ -1,7 +0,0 @@ - 450, ]; + // TODO create enum for this? private static array $exceptionCodeMapping = [ // cxml 450 => 'Not Implemented', diff --git a/tests/CXmlTest/Handling/EndpointTest.php b/tests/CXmlTest/Handling/EndpointTest.php new file mode 100644 index 0000000..0d5c085 --- /dev/null +++ b/tests/CXmlTest/Handling/EndpointTest.php @@ -0,0 +1,98 @@ +registerCredential( + new Credential( + 'NetworkId', + 'AN00000123' + ) + ); + $credentialRepository->registerCredential( + new Credential( + 'NetworkId', + 'AN00000456' + ) + ); + + $authenticator = new SimpleSharedSecretAuthenticator('Secret!123'); + + $requestProcessor = new HeaderProcessor( + $credentialRepository, + $authenticator + ); + + $handlerRegistry = new HandlerRegistry(); + $handlerRegistry->register(new class() implements HandlerInterface { + public static function getRequestName(): string + { + return 'QuoteMessage'; + } + + public function handle(PayloadInterface $payload, Context $context): ?ResponsePayloadInterface + { + return null; + } + }); + + + $builder = Builder::create(); + + $processor = new Processor( + $requestProcessor, + $handlerRegistry, + $builder + ); + + $endpoint = new Endpoint( + $serializer, + $messageValidator, + $processor + ); + + $actualResponseCxml = $endpoint->parseAndProcessStringAsCXml($requestCxml); + $this->assertEquals($expectedResponseCxml, $actualResponseCxml); + } +} diff --git a/tests/CXmlTest/Handling/fixtures/quote_request.xml b/tests/CXmlTest/Handling/fixtures/quote_request.xml new file mode 100644 index 0000000..0e8e9b8 --- /dev/null +++ b/tests/CXmlTest/Handling/fixtures/quote_request.xml @@ -0,0 +1,69 @@ + + + +
+ + + AN00000123 + + + + + AN00000456 + + + + + AN00000123 + Secret!123 + + Suppliers Super Order Processor + +
+ + + + + + identity + + + + + 100.00 + + + +
+ Acme Inc. + + Acme Inc. + Joe Smith + 123 Anystreet + Sunnyvale + CA + 90489 + United States + + + + 1 + 800 + 1234567 + + +
+
+ + + Joe Smith + joe.smith@siemens.com + + + + This is a comment + 2023-01-08T23:00:06-08:00 +
+
+
+
\ No newline at end of file