|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Fhp; |
| 4 | + |
| 5 | +use Tests\Fhp\Integration\Atruvia\SendTransferVoPTest; |
| 6 | + |
| 7 | +class BaseActionVopSerializationTest extends SendTransferVoPTest |
| 8 | +{ |
| 9 | + /** |
| 10 | + * @throws \Throwable |
| 11 | + */ |
| 12 | + public function testSerializesPollingInfo() |
| 13 | + { |
| 14 | + // We piggy-back on the Atruvia integration test to provide an action that has some reasonable data inside and |
| 15 | + // has already been executed so that polling is now required. |
| 16 | + $this->initDialog(); |
| 17 | + $originalAction = $this->createAction(); |
| 18 | + $this->expectMessage(static::SEND_TRANSFER_REQUEST, mb_convert_encoding(static::SEND_TRANSFER_RESPONSE_POLLING_NEEDED, 'ISO-8859-1', 'UTF-8')); |
| 19 | + $this->fints->execute($originalAction); |
| 20 | + |
| 21 | + // Sanity-check that the polling is now expected. |
| 22 | + $this->assertNotNull($originalAction->getPollingInfo()); |
| 23 | + |
| 24 | + // Do a serialization roundtrip. |
| 25 | + $serializedAction = serialize($originalAction); |
| 26 | + $unserializedAction = unserialize($serializedAction); |
| 27 | + |
| 28 | + // Verify that the polling info is still the same. |
| 29 | + $this->assertEquals($originalAction->getPollingInfo(), $unserializedAction->getPollingInfo()); |
| 30 | + } |
| 31 | + |
| 32 | + /** |
| 33 | + * @throws \Throwable |
| 34 | + */ |
| 35 | + public function testSerializesVopConfirmationRequest() |
| 36 | + { |
| 37 | + // We piggy-back on the Atruvia integration test to provide an action that has some reasonable data inside and |
| 38 | + // has already been executed so that polling is now required. |
| 39 | + $this->initDialog(); |
| 40 | + $originalAction = $this->createAction(); |
| 41 | + $this->expectMessage(static::SEND_TRANSFER_REQUEST, mb_convert_encoding(static::SEND_TRANSFER_RESPONSE_POLLING_NEEDED, 'ISO-8859-1', 'UTF-8')); |
| 42 | + $response = static::buildVopReportResponse(static::VOP_REPORT_PARTIAL_MATCH_RESPONSE, static::VOP_REPORT_PARTIAL_MATCH_XML_PAYLOAD); |
| 43 | + $this->expectMessage(static::POLL_VOP_REQUEST, $response); |
| 44 | + $this->fints->execute($originalAction); |
| 45 | + $this->assertTrue($originalAction->needsPollingWait()); |
| 46 | + $this->fints->pollAction($originalAction); |
| 47 | + |
| 48 | + // Sanity-check that the VOP confirmation is now expected. |
| 49 | + $this->assertNotNull($originalAction->getVopConfirmationRequest()); |
| 50 | + |
| 51 | + // Do a serialization roundtrip. |
| 52 | + $serializedAction = serialize($originalAction); |
| 53 | + $unserializedAction = unserialize($serializedAction); |
| 54 | + |
| 55 | + // Verify that the polling info is still the same. |
| 56 | + $this->assertEquals($originalAction->getVopConfirmationRequest(), $unserializedAction->getVopConfirmationRequest()); |
| 57 | + } |
| 58 | +} |
0 commit comments