Skip to content

Commit

Permalink
Issue #67: Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ademarco committed Dec 12, 2017
1 parent 96f7783 commit c49829d
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 45 deletions.
4 changes: 2 additions & 2 deletions src/Messages/Components/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public function getAttributes()
{
$attributes = [
'channel' => $this->getChannel(),
'dealine' => $this->getDeadline(),
'statusDealine' => $this->getDeadlineStatus(),
'deadline' => $this->getDeadline(),
'statusDeadline' => $this->getDeadlineStatus(),
'marked' => $this->getConfidential(),
'format' => $this->getFormat(),
'legiswrite' => $this->getLegiswriteFormat(),
Expand Down
4 changes: 2 additions & 2 deletions templates/components/contact.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*/
?>
<contacts <?= $this->attributes($component->getAttributes()) ?>>
<contactNickname><?= $component->getNickname() ?></contactNickname>
<contactNickname><![CDATA[<?= $component->getNickname() ?>]]></contactNickname>
<?php if ($component->getEmail()) : ?>
<contactEmail><?= $component->getEmail() ?></contactEmail>
<contactEmail><![CDATA[<?= $component->getEmail() ?>]]></contactEmail>
<?php endif ?>
</contacts>
6 changes: 3 additions & 3 deletions templates/components/reference-document.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
<documentReference <?= $this->attributes($component->getAttributes()) ?>>
<documentReferenceName><![CDATA[<?= $component->getName() ?>]]></documentReferenceName>
<?php if ($component->getPath()) : ?>
<documentReferencePath><?= $component->getPath() ?></documentReferencePath>
<documentReferencePath><![CDATA[<?= $component->getPath() ?>]]></documentReferencePath>
<?php endif ?>
<?php if ($component->getSize()) : ?>
<documentReferenceSize><?= $component->getSize() ?></documentReferenceSize>
<documentReferenceSize><![CDATA[<?= $component->getSize() ?>]]></documentReferenceSize>
<?php endif ?>
<?php if ($component->getRemark()) : ?>
<documentReferenceRemark><![CDATA[<?= $component->getRemark() ?>]]></documentReferenceRemark>
<?php endif ?>
<documentReferenceFile><?= $component->getFile() ?></documentReferenceFile>
<documentReferenceFile><![CDATA[<?= $component->getFile() ?>]]></documentReferenceFile>
</documentReference>
5 changes: 5 additions & 0 deletions templates/components/return-address.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@
<retourRemark><![CDATA[<?= $component->getRemark() ?>]]></retourRemark>
<?php endif ?>
</retour>





4 changes: 2 additions & 2 deletions templates/components/source.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
<documentSourceName><![CDATA[<?= $component->getName() ?>]]></documentSourceName>
<documentSourceFile><![CDATA[<?= $component->getFile() ?>]]></documentSourceFile>
<?php if ($component->getPath()) : ?>
<documentSourcePath><?= $component->getPath() ?></documentSourcePath>
<documentSourcePath><![CDATA[<?= $component->getPath() ?>]]></documentSourcePath>
<?php endif ?>
<?php if ($component->getSourceLanguages()) : ?>
<?php foreach ($component->getSourceLanguages() as $target) : ?>
<?= $this->component($target); ?>
<?php endforeach; ?>
<?php endif; ?>
<?php if ($component->getSize()) : ?>
<documentSourceSize><?= $component->getSize() ?></documentSourceSize>
<documentSourceSize><![CDATA[<?= $component->getSize() ?>]]></documentSourceSize>
<?php endif ?>
</documentSource>
2 changes: 1 addition & 1 deletion tests/src/SanitizationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function testSensitization($name, array $setters, array $getters)

$actual = $poetry->get('component.'.$name)->fromXml($xml);
// If XML is not valid test will fail here.
$xml = new \SimpleXMLElement($xml);
new \SimpleXMLElement($xml);
foreach ($getters as $getter => $value) {
expect($actual->$getter($value))->to->equal($value);
}
Expand Down
146 changes: 111 additions & 35 deletions tests/src/fixtures/sanitization.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,113 @@
- component: details
#- component: details
# setters:
# setClientId: "<ID>"
# setResponsible: "</Responsible>"
# setApplicationId: "application .>? Id"
# setAuthor: "DIGIT \ <> "
# setRequester: "DGCOMM \\<>"
# setTitle: "Title > <"
# setRemark: "Remark!!{}"
# setType: "INTER*^%(#"
# setDestination: "AUTRE{}<[[]]"
# setProcedure: "NEANT"
# setDelay: "11/12/\\2007"
# setRequestDate: "11\/12/2007"
# setStatus: "Ready!><"
# setInterServices: "<Yes?"
# setInterInstitution: "/<Yes>"
# setReferenceFilesRemark: "<<<Note>>>"
# setWorkflowCode: "!!STS"
# getters:
# getClientId: "<ID>"
# getResponsible: "</Responsible>"
# getApplicationId: "application .>? Id"
# getAuthor: "DIGIT \ <> "
# getRequester: "DGCOMM \\<>"
# getTitle: "Title > <"
# getRemark: "Remark!!{}"
# getType: "INTER*^%(#"
# getDestination: "AUTRE{}<[[]]"
# getProcedure: "NEANT"
# getDelay: "11/12/\\2007"
# getRequestDate: "11\/12/2007"
# getStatus: "Ready!><"
# getInterServices: "<Yes?"
# getInterInstitution: "/<Yes>"
# getReferenceFilesRemark: "<<<Note>>>"
# getWorkflowCode: "!!STS"
#
#- component: contact
# setters:
# setType: '<Type>'
# setAction: '<Action>'
# setNickname: '<.> </>*&^%$#@!'
# setEmail: '[email protected]'
# getters:
# getType: '<Type>'
# getAction: '<Action>'
# getNickname: '<.> </>*&^%$#@!'
# getEmail: '[email protected]'
#
#- component: reference_document
# setters:
# setLanguage: '< !@#$%^&*()_"''+ >'
# setFormat: '< !@#$%^&*()_+ >'
# setType: '< !@#$%^&*()_+ >'
# setAction: '< !@#$%^&*()_+ >'
# setName: '</Name>'
# setPath: '<.> </>*&^%$#@!'
# setSize: '123Mb<>'
# setFile: '<File>'
# getters:
# getLanguage: '< !@#$%^&*()_"''+ >'
# getFormat: '< !@#$%^&*()_+ >'
# getType: '< !@#$%^&*()_+ >'
# getAction: '< !@#$%^&*()_+ >'
# getName: '</Name>'
# getPath: '<.> </>*&^%$#@!'
# getSize: '123Mb<>'
# getFile: '<File>'
#
#- component: return_address
# setters:
# setType: "<'\"!@#$>"
# setAction: "<'\"!@#$>"
# setUser: "<'\"!@#$>"
# setPassword: "<'\"!@#$>"
# setAddress: "<'\"!@#$>"
# setPath: "<'\"!@#$>"
# setRemark: "<'\"!@#$>"
# getters:
# getType: "<'\"!@#$>"
# getAction: "<'\"!@#$>"
# getUser: "<'\"!@#$>"
# getPassword: "<'\"!@#$>"
# getAddress: "<'\"!@#$>"
# getPath: "<'\"!@#$>"
# getRemark: "<'\"!@#$>"

- component: source
setters:
setClientId: "<ID>"
setResponsible: "</Responsible>"
setApplicationId: "applicationId"
setAuthor: "DIGIT \ <> "
setRequester: "DGCOMM \\<>"
setTitle: "Title > <"
setRemark: "Remark!!{}"
setType: "INTER*^%(#"
setDestination: "AUTRE{}<[[]]"
setProcedure: "NEANT"
setDelay: "11/12/\\2007"
setRequestDate: "11\/12/2007"
setStatus: "Ready!><"
setInterServices: "<Yes?"
setInterInstitution: "/<Yes>"
setReferenceFilesRemark: "<<<Note>>>"
setWorkflowCode: "!!STS"
setChannel: '<id="setChannel"></123>'
setDeadline: '<id="setDeadline"></123>'
setDeadlineStatus: '<id="setDeadlineStatus"></123>'
setConfidential: '<id="setConfidential"></123>'
setFormat: '<id="setFormat"></123>'
setLegiswriteFormat: '<id="setLegiswriteFormat"></123>'
setTrackChanges: '<id="setTrackChanges"></123>'
setName: '<id="setName"></123>'
setFile: '<id="setFile"></123>'
setPath: '<id="setPath"></123>'
setSize: '<id="setSize"></123>'
getters:
getClientId: "<ID>"
getResponsible: "</Responsible>"
getApplicationId: "applicationId"
getAuthor: "DIGIT \ <> "
getRequester: "DGCOMM \\<>"
getTitle: "Title > <"
getRemark: "Remark!!{}"
getType: "INTER*^%(#"
getDestination: "AUTRE{}<[[]]"
getProcedure: "NEANT"
getDelay: "11/12/\\2007"
getRequestDate: "11\/12/2007"
getStatus: "Ready!><"
getInterServices: "<Yes?"
getInterInstitution: "/<Yes>"
getReferenceFilesRemark: "<<<Note>>>"
getWorkflowCode: "!!STS"
getChannel: '<id="setChannel"></123>'
getDeadline: '<id="setDeadline"></123>'
getDeadlineStatus: '<id="setDeadlineStatus"></123>'
getConfidential: '<id="setConfidential"></123>'
getFormat: '<id="setFormat"></123>'
getLegiswriteFormat: '<id="setLegiswriteFormat"></123>'
getTrackChanges: '<id="setTrackChanges"></123>'
getName: '<id="setName"></123>'
getFile: '<id="setFile"></123>'
getPath: '<id="setPath"></123>'
getSize: '<id="setSize"></123>'

0 comments on commit c49829d

Please sign in to comment.