Skip to content

Commit

Permalink
[FEATURE#128384] fix(SprinterService): Les options libres sont mergée…
Browse files Browse the repository at this point in the history
…s avec les params
  • Loading branch information
aurelienCastellarnau committed Jun 27, 2019
1 parent ab42c72 commit 5b3a5ee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 5 additions & 3 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public function jeVeuxEnvoyerLeTemplateAvecLeStudent($template, $student_array)
function () use ($container, $template, $file, $student) {
$sprinter = $container->get('sprinter.sprinter_service');
$routing_key = $sprinter->getDefaultRoutingKey();
$sprinter->sendPrint($template, $file, false, $routing_key, $student);
$opts = ["to test opts add" => "we put any shit on it"];
$sprinter->sendPrint($template, $file, false, $routing_key, $student, $opts);
}
);
}
Expand All @@ -70,9 +71,10 @@ public function jeVeuxEnvoyerLeTemplateAvecLeStudentEtUnPrintFlagMoisi($template
$student = include $path_to_student;
$this->getContext("ETNA\FeatureContext\ExceptionContainerContext")->try(
function () use ($container, $template, $file, $student) {
$sprinter = $container->get('sprinter.sprinter_service');
$sprinter = $container->get('sprinter.sprinter_service');
$routing_key = $sprinter->getDefaultRoutingKey();
$sprinter->sendPrint($template, $file, "\xB1\x31", $routing_key, $student);
$opts = ["to test opts add" => "we put any shit on it"];
$sprinter->sendPrint($template, $file, "\xB1\x31", $routing_key, $student, $opts);
}
);
}
Expand Down
2 changes: 1 addition & 1 deletion features/suites/results/sprinter_body.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"Content": "c3R1ZGVudF9pZDtzdHVkZW50X3VzZXJfaWQ7c3R1ZGVudF9wcm9zcGVjdF9pZDtzdHVkZW50X2xvZ2luO3N0dWRlbnRfYmlydGhkYXk7c3R1ZGVudF9iaXJ0aGRheV9wbGFjZTtzdHVkZW50X25hdGlvbmFsaXR5O3N0dWRlbnRfZW1haWxfZXRuYTtzdHVkZW50X3RlbF9wcm87c3R1ZGV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RlZF9hdDtsYXN0X3Rlcm1fZGVuaWVkX2F0CjI7Mjs7YW5jZXNjX2w7MTk4My0wMy0wNFQwMDowMDowMCswMDowMDsiQm9uZHkgKDkzKSI7RlJBTkNBSVNFO2FuY2VzY19sQGV0bmEtYWx0ZXJuYW5jZS5uZXQ7Ozs7Ozs7O0JBQzsyMDAwLTAxLTAxVDAwOjAwOjAwKzAwOjAwOzIwMDktMDYtMDZUMDA6MDA6MDArMDA6MDA7Ozs7Ozs7Ozs7O01vbnNpZXVyOzs7Ozs7Ozs7OztNYWRhbWU7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7TW9uc2lldXI7QU5DRVNDSEk7TGF1cmVudDsibGF1cmVudC5hbmNlc2NoaUBnbWFpbC5jb20gIjswNjI1MjYzNTMxOzsiMzEsIGF2ZW51ZSBNYXJpZSBDdXJpZSAiOzs3NzYwMDsiQlVTU1kgU1QgR0VPUkdFUyI7RlJBTkNFOzQ7ZXRuYTM7MjAwODtJRFY7MjAwNy0wOS0wMVQwMDowMDowMCswMDowMDsyMDA4LTA4LTMxVDAwOjAwOjAwKzAwOjAwOzt2YWxpZDsyMDE1LTAyLTE4VDE0OjU4OjI1KzAwOjAwOzs="
},
"printflag": false,
"opts": []
"to test opts add": "we put any shit on it"
}
8 changes: 5 additions & 3 deletions src/Services/SprinterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ public function sendPrint(
'template' => $template,
'data' => $data,
'printflag' => $print_flag,
'opts' => $sprinter_opts,
];
$routing_key = $routing_key ?: $this->routing_key;
$msgBody = json_encode($params);
if (!empty($sprinter_opts)) {
$params = array_merge($params, $sprinter_opts);
}
$routing_key = $routing_key ?: $this->routing_key;
$msgBody = json_encode($params);
if (false === $msgBody) {
throw new \Exception(
'Encoding message to producer failed',
Expand Down

0 comments on commit 5b3a5ee

Please sign in to comment.