diff --git a/tests/src/Messages/Components/ContactTest.php b/tests/src/Messages/Components/ContactTest.php
index a2fc915..d4afca2 100644
--- a/tests/src/Messages/Components/ContactTest.php
+++ b/tests/src/Messages/Components/ContactTest.php
@@ -46,10 +46,7 @@ public function testValidation()
*/
public function testWithXml($xml, $expressions)
{
- /** @var \EC\Poetry\Messages\Responses\Status $message */
- $message = $this->getContainer()
- ->get('component.contact')
- ->withXml($xml);
+ $message = $this->getContainer()->get('component.contact')->withXml($xml);
$this->assertExpressions($expressions, ['message' => $message]);
}
diff --git a/tests/src/Messages/Components/DetailsTest.php b/tests/src/Messages/Components/DetailsTest.php
index f289761..ac3cdd0 100644
--- a/tests/src/Messages/Components/DetailsTest.php
+++ b/tests/src/Messages/Components/DetailsTest.php
@@ -41,10 +41,7 @@ public function testValidation()
*/
public function testWithXml($xml, $expressions)
{
- /** @var \EC\Poetry\Messages\Responses\Status $message */
- $message = $this->getContainer()
- ->get('component.details')
- ->withXml($xml);
+ $message = $this->getContainer()->get('component.details')->withXml($xml);
$this->assertExpressions($expressions, ['message' => $message]);
}
diff --git a/tests/src/Messages/Components/IdentifierTest.php b/tests/src/Messages/Components/IdentifierTest.php
index b138b25..a5b36d7 100644
--- a/tests/src/Messages/Components/IdentifierTest.php
+++ b/tests/src/Messages/Components/IdentifierTest.php
@@ -47,10 +47,7 @@ public function testValidation()
*/
public function testWithXml($xml, $expressions)
{
- /** @var \EC\Poetry\Messages\Responses\Status $message */
- $message = $this->getContainer()
- ->get('component.identifier')
- ->withXml($xml);
+ $message = $this->getContainer()->get('component.identifier')->withXml($xml);
$this->assertExpressions($expressions, ['message' => $message]);
}
diff --git a/tests/src/Messages/Components/ReferenceDocumentTest.php b/tests/src/Messages/Components/ReferenceDocumentTest.php
index 8ab3322..37deddf 100644
--- a/tests/src/Messages/Components/ReferenceDocumentTest.php
+++ b/tests/src/Messages/Components/ReferenceDocumentTest.php
@@ -40,20 +40,15 @@ public function testValidation()
}
/**
- * Test parsing.
- *
* @param string $xml
- * @param array $fixtures
+ * @param array $expressions
*
* @dataProvider parserProvider
*/
- public function testParsing($xml, $fixtures)
+ public function testWithXml($xml, $expressions)
{
- /** @var \EC\Poetry\Messages\Components\ReferenceDocument $component */
- $component = $this->getContainer()->get('component.reference_document')->withXml($xml);
- foreach ($fixtures as $method => $value) {
- expect($component->$method())->to->equal($value);
- }
+ $message = $this->getContainer()->get('component.reference_document')->withXml($xml);
+ $this->assertExpressions($expressions, ['message' => $message]);
}
/**
@@ -61,6 +56,6 @@ public function testParsing($xml, $fixtures)
*/
public function parserProvider()
{
- return Yaml::parse($this->getFixture('factories/with-xml/components/referenceDocument.yml'));
+ return Yaml::parse($this->getFixture('factories/with-xml/components/reference-document.yml'));
}
}
diff --git a/tests/src/Messages/Components/ReturnAddressTest.php b/tests/src/Messages/Components/ReturnAddressTest.php
index f6f32a4..a89e4c7 100644
--- a/tests/src/Messages/Components/ReturnAddressTest.php
+++ b/tests/src/Messages/Components/ReturnAddressTest.php
@@ -37,21 +37,15 @@ public function testValidation()
}
/**
- * Test parsing.
- *
* @param string $xml
- * @param array $fixtures
+ * @param array $expressions
*
* @dataProvider parserProvider
*/
- public function testParsing($xml, $fixtures)
+ public function testWithXml($xml, $expressions)
{
- /** @var \EC\Poetry\Messages\Components\ReturnAddress $component */
- $component = $this->getContainer()->get('component.return_address')->withXml($xml);
-
- foreach ($fixtures as $method => $value) {
- expect($component->$method())->to->equal($value);
- }
+ $message = $this->getContainer()->get('component.return_address')->withXml($xml);
+ $this->assertExpressions($expressions, ['message' => $message]);
}
/**
@@ -59,6 +53,6 @@ public function testParsing($xml, $fixtures)
*/
public function parserProvider()
{
- return Yaml::parse($this->getFixture('factories/with-xml/components/returnAddress.yml'));
+ return Yaml::parse($this->getFixture('factories/with-xml/components/return-address.yml'));
}
}
diff --git a/tests/src/Messages/Components/SourceTest.php b/tests/src/Messages/Components/SourceTest.php
index 8784ac1..cd2b7f0 100644
--- a/tests/src/Messages/Components/SourceTest.php
+++ b/tests/src/Messages/Components/SourceTest.php
@@ -43,27 +43,15 @@ public function testValidation()
}
/**
- * Test parsing.
- *
* @param string $xml
- * @param array $expected
+ * @param array $expressions
*
* @dataProvider parserProvider
*/
- public function testParsing($xml, $expected)
+ public function testWithXml($xml, $expressions)
{
- /** @var \EC\Poetry\Messages\Components\Source $component */
- $component = $this->getContainer()->get('component.source')->withXml($xml);
-
- foreach ($expected as $getComponent => $properties) {
- if ($this->isComponentCollection($properties)) {
- foreach ($properties as $i => $property) {
- $this->assertProperties($component->$getComponent()[$i], $property);
- }
- } else {
- expect($component->$getComponent())->to->equal($properties);
- }
- }
+ $message = $this->getContainer()->get('component.source')->withXml($xml);
+ $this->assertExpressions($expressions, ['message' => $message]);
}
/**
diff --git a/tests/src/Messages/Components/StatusTest.php b/tests/src/Messages/Components/StatusTest.php
index 148ea30..eb66f10 100644
--- a/tests/src/Messages/Components/StatusTest.php
+++ b/tests/src/Messages/Components/StatusTest.php
@@ -34,27 +34,15 @@ public function testValidation()
}
/**
- * Test parsing.
- *
* @param string $xml
- * @param string $date
- * @param string $time
- * @param string $message
- * @param string $code
- * @param string $type
+ * @param array $expressions
*
* @dataProvider parserProvider
*/
- public function testParsing($xml, $date, $time, $message, $code, $type)
+ public function testWithXml($xml, $expressions)
{
- /** @var \EC\Poetry\Messages\Components\Status $component */
- $component = $this->getContainer()->get('component.status')->withXml($xml);
-
- expect($component->getDate())->to->equal($date);
- expect($component->getTime())->to->equal($time);
- expect($component->getMessage())->to->equal($message);
- expect($component->getCode())->to->equal($code);
- expect($component->getType())->to->equal($type);
+ $message = $this->getContainer()->get('component.status')->withXml($xml);
+ $this->assertExpressions($expressions, ['message' => $message]);
}
/**
diff --git a/tests/src/Messages/Components/TargetTest.php b/tests/src/Messages/Components/TargetTest.php
index 15d6a8b..867f0df 100644
--- a/tests/src/Messages/Components/TargetTest.php
+++ b/tests/src/Messages/Components/TargetTest.php
@@ -52,34 +52,16 @@ public function testValidation()
}
/**
- * Test parsing.
- *
* @param string $xml
- * @param array $targetProperties
- * @param array $addressProperties
- * @param array $contactProperties
+ * @param array $expressions
*
* @dataProvider parserProvider
*/
- public function testParsing($xml, $targetProperties, $addressProperties, $contactProperties)
+ public function testWithXml($xml, $expressions)
{
- /** @var \EC\Poetry\Messages\Components\Target $target */
- $target = $this->getContainer()->get('component.target')->withXml($xml);
-
- foreach ($targetProperties as $method => $value) {
- expect($target->$method())->to->equal($value);
- }
- $returnAddress = $target->getReturnAddresses()[0];
- foreach ($addressProperties as $method => $value) {
- expect($returnAddress->$method())->to->equal($value);
- }
- expect(count($target->getContacts()))->to->equal(1);
- $contact = $target->getContacts()[0];
- foreach ($contactProperties as $method => $value) {
- expect($contact->$method())->to->equal($value);
- }
+ $message = $this->getContainer()->get('component.target')->withXml($xml);
+ $this->assertExpressions($expressions, ['message' => $message]);
}
-
/**
* @return mixed
*/
diff --git a/tests/src/Messages/Notifications/StatusUpdatedTest.php b/tests/src/Messages/Notifications/StatusUpdatedTest.php
index 760c296..72fce42 100644
--- a/tests/src/Messages/Notifications/StatusUpdatedTest.php
+++ b/tests/src/Messages/Notifications/StatusUpdatedTest.php
@@ -69,10 +69,7 @@ public function testRender()
*/
public function testWithXml($xml, $expressions)
{
- /** @var \EC\Poetry\Messages\Notifications\TranslationReceived $message */
- $message = $this->getContainer()
- ->get('notification.status_updated')
- ->withXml($xml);
+ $message = $this->getContainer()->get('notification.status_updated')->withXml($xml);
$this->assertExpressions($expressions, ['message' => $message]);
}
diff --git a/tests/src/Messages/Notifications/TranslationReceivedTest.php b/tests/src/Messages/Notifications/TranslationReceivedTest.php
index 64afd84..54eaf03 100644
--- a/tests/src/Messages/Notifications/TranslationReceivedTest.php
+++ b/tests/src/Messages/Notifications/TranslationReceivedTest.php
@@ -51,10 +51,7 @@ public function testRender()
*/
public function testWithXml($xml, $expressions)
{
- /** @var \EC\Poetry\Messages\Notifications\TranslationReceived $message */
- $message = $this->getContainer()
- ->get('notification.translation_received')
- ->withXml($xml);
+ $message = $this->getContainer()->get('notification.translation_received')->withXml($xml);
$this->assertExpressions($expressions, ['message' => $message]);
}
diff --git a/tests/src/Messages/Responses/StatusTest.php b/tests/src/Messages/Responses/StatusTest.php
index d7bff62..1ab2d8d 100644
--- a/tests/src/Messages/Responses/StatusTest.php
+++ b/tests/src/Messages/Responses/StatusTest.php
@@ -25,10 +25,7 @@ class StatusTest extends AbstractTest
*/
public function testWithXml($xml, $expressions)
{
- /** @var \EC\Poetry\Messages\Responses\Status $message */
- $message = $this->getContainer()
- ->get('response.status')
- ->withXml($xml);
+ $message = $this->getContainer()->get('response.status')->withXml($xml);
$this->assertExpressions($expressions, ['message' => $message]);
}
diff --git a/tests/src/fixtures/factories/with-xml/components/referenceDocument.yml b/tests/src/fixtures/factories/with-xml/components/reference-document.yml
similarity index 54%
rename from tests/src/fixtures/factories/with-xml/components/referenceDocument.yml
rename to tests/src/fixtures/factories/with-xml/components/reference-document.yml
index 6982e53..68fa676 100644
--- a/tests/src/fixtures/factories/with-xml/components/referenceDocument.yml
+++ b/tests/src/fixtures/factories/with-xml/components/reference-document.yml
@@ -1,5 +1,5 @@
-
- -
+ xml:
Filename
path
@@ -7,12 +7,14 @@
Remark
File
- - getLanguage : "en"
- getFormat : "HTML"
- getType : "REF"
- getAction : "UPDATE"
- getName : "Filename"
- getPath : "path"
- getSize : "10kB"
- getRemark : "Remark"
- getFile : "File"
+
+ expressions:
+ - message.getLanguage() == "en"
+ - message.getFormat() == "HTML"
+ - message.getType() == "REF"
+ - message.getAction() == "UPDATE"
+ - message.getName() == "Filename"
+ - message.getPath() == "path"
+ - message.getSize() == "10kB"
+ - message.getRemark() == "Remark"
+ - message.getFile() == "File"
diff --git a/tests/src/fixtures/factories/with-xml/components/return-address.yml b/tests/src/fixtures/factories/with-xml/components/return-address.yml
new file mode 100644
index 0000000..ebb3201
--- /dev/null
+++ b/tests/src/fixtures/factories/with-xml/components/return-address.yml
@@ -0,0 +1,18 @@
+-
+ xml:
+
+ Username
+ Password
+ Url
+ Path
+ Remark
+
+
+ expressions:
+ - message.getType() == "webService"
+ - message.getAction() == "INSERT"
+ - message.getUser() == "Username"
+ - message.getPassword() == "Password"
+ - message.getAddress() == "Url"
+ - message.getPath() == "Path"
+ - message.getRemark() == "Remark"
diff --git a/tests/src/fixtures/factories/with-xml/components/returnAddress.yml b/tests/src/fixtures/factories/with-xml/components/returnAddress.yml
deleted file mode 100644
index 51cb739..0000000
--- a/tests/src/fixtures/factories/with-xml/components/returnAddress.yml
+++ /dev/null
@@ -1,16 +0,0 @@
--
- -
-
- Username
- Password
- Url
- Path
- Remark
-
- - getType : "webService"
- getAction : "INSERT"
- getUser : "Username"
- getPassword : "Password"
- getAddress : "Url"
- getPath : "Path"
- getRemark : "Remark"
diff --git a/tests/src/fixtures/factories/with-xml/components/source.yml b/tests/src/fixtures/factories/with-xml/components/source.yml
index 8118752..11e78b4 100644
--- a/tests/src/fixtures/factories/with-xml/components/source.yml
+++ b/tests/src/fixtures/factories/with-xml/components/source.yml
@@ -1,5 +1,5 @@
-
- -
+ xml:
Name
Path
@@ -12,21 +12,20 @@
10kB
File
- - getChannel: "POETRY"
- getFormat: "HTML"
- getDeadline: "11/07/2007"
- getDeadlineStatus: "PUBLIC"
- getConfidential: "No"
- getLegiswriteFormat: "Yes"
- getTrackChanges: "No"
- getName: "Name"
- getPath: "Path"
- getSourceLanguages:
- -
- getCode: 'en'
- getPages: '1'
- -
- getCode: 'fr'
- getPages: '2'
- getSize: "10kB"
- getFile: "File"
+
+ expressions:
+ - message.getChannel() == "POETRY"
+ - message.getFormat() == "HTML"
+ - message.getDeadline() == "11/07/2007"
+ - message.getDeadlineStatus() == "PUBLIC"
+ - message.getConfidential() == "No"
+ - message.getLegiswriteFormat() == "Yes"
+ - message.getTrackChanges() == "No"
+ - message.getName() == "Name"
+ - message.getPath() == "Path"
+ - message.getSourceLanguages()[0].getCode() == 'en'
+ - message.getSourceLanguages()[0].getPages() == '1'
+ - message.getSourceLanguages()[1].getCode() == 'fr'
+ - message.getSourceLanguages()[1].getPages() == '2'
+ - message.getSize() == "10kB"
+ - message.getFile() == "File"
diff --git a/tests/src/fixtures/factories/with-xml/components/status.yml b/tests/src/fixtures/factories/with-xml/components/status.yml
index c595694..e206878 100644
--- a/tests/src/fixtures/factories/with-xml/components/status.yml
+++ b/tests/src/fixtures/factories/with-xml/components/status.yml
@@ -1,25 +1,29 @@
-
- -
+ xml:
15/01/2017
12:30:00
OK
- - "15/01/2017"
- - "12:30:00"
- - "OK"
- - "0"
- - "request"
+
+ expressions:
+ - message.getDate() == "15/01/2017"
+ - message.getTime() == "12:30:00"
+ - message.getMessage() == "OK"
+ - message.getCode() == "0"
+ - message.getType() == "request"
-
- -
+ xml:
12:30:00
OK
- - null
- - "12:30:00"
- - "OK"
- - null
- - "request"
+
+ expressions:
+ - message.getDate() == null
+ - message.getTime() == "12:30:00"
+ - message.getMessage() == "OK"
+ - message.getCode() == null
+ - message.getType() == "request"
diff --git a/tests/src/fixtures/factories/with-xml/components/target.yml b/tests/src/fixtures/factories/with-xml/components/target.yml
index 156b0ca..707a585 100644
--- a/tests/src/fixtures/factories/with-xml/components/target.yml
+++ b/tests/src/fixtures/factories/with-xml/components/target.yml
@@ -1,5 +1,5 @@
-
- -
+ xml:
Remark
10/07/2007
@@ -17,22 +17,24 @@
user@mail.com
- - getFormat : "HTML"
- getLanguage : "en"
- getTrackChanges : "No"
- getRemark : "Remark"
- getDelay : "10/07/2007"
- getDelayFormat : "dd/mm/YYYY"
- getAcceptedDelay : "10/07/2007"
- getAcceptedDelayFormat : "dd/mm/YYYY"
- getTranslatedFile : "File"
- getRemark : "Remark"
- - getType : "webService"
- getUser : "Username"
- getPassword : "Password"
- getAddress : "Url"
- getPath : "Path"
- getRemark : "Remark"
- - getType : "Secretaire"
- getNickname : "Username"
- getEmail : "user@mail.com"
\ No newline at end of file
+
+ expressions:
+ - message.getFormat() == "HTML"
+ - message.getLanguage() == "en"
+ - message.getTrackChanges() == "No"
+ - message.getRemark() == "Remark"
+ - message.getDelay() == "10/07/2007"
+ - message.getDelayFormat() == "dd/mm/YYYY"
+ - message.getAcceptedDelay() == "10/07/2007"
+ - message.getAcceptedDelayFormat() == "dd/mm/YYYY"
+ - message.getTranslatedFile() == "File"
+ - message.getRemark() == "Remark"
+ - message.getReturnAddresses()[0].getType() == "webService"
+ - message.getReturnAddresses()[0].getUser() == "Username"
+ - message.getReturnAddresses()[0].getPassword() == "Password"
+ - message.getReturnAddresses()[0].getAddress() == "Url"
+ - message.getReturnAddresses()[0].getPath() == "Path"
+ - message.getReturnAddresses()[0].getRemark() == "Remark"
+ - message.getContacts()[0].getType() == "Secretaire"
+ - message.getContacts()[0].getNickname() == "Username"
+ - message.getContacts()[0].getEmail() == "user@mail.com"