Skip to content

Commit

Permalink
Fix tests when translation generator returns null (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Ducoudray authored and cdaguerre committed Feb 15, 2017
1 parent 9a9df2e commit 94b1abf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Features/Context/TranslationContextTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,16 @@ public function createTranslationProject(TableNode $table)
json_decode($data['textmasters'], true)
);

PHPUnit_Framework_Assert::assertSame($data['name'], $project->getName());
PHPUnit_Framework_Assert::assertSame(isset($data['activity']) ? $data['activity'] : null, $project->getActivity());
PHPUnit_Framework_Assert::assertSame($data['languageFrom'], $project->getLanguageFrom());
PHPUnit_Framework_Assert::assertSame(isset($data['languageTo']) ? $data['languageTo'] : null, $project->getLanguageTo());
PHPUnit_Framework_Assert::assertSame($data['category'], $project->getCategory());
PHPUnit_Framework_Assert::assertSame($data['briefing'], $project->getBriefing());
PHPUnit_Framework_Assert::assertSame(json_decode($data['options'], true), $project->getOptions());
PHPUnit_Framework_Assert::assertSame(json_decode($data['textmasters'], true), $project->getTextmasters());
if (null !== $project) {
PHPUnit_Framework_Assert::assertSame($data['name'], $project->getName());
PHPUnit_Framework_Assert::assertSame(isset($data['activity']) ? $data['activity'] : null, $project->getActivity());
PHPUnit_Framework_Assert::assertSame($data['languageFrom'], $project->getLanguageFrom());
PHPUnit_Framework_Assert::assertSame(isset($data['languageTo']) ? $data['languageTo'] : null, $project->getLanguageTo());
PHPUnit_Framework_Assert::assertSame($data['category'], $project->getCategory());
PHPUnit_Framework_Assert::assertSame($data['briefing'], $project->getBriefing());
PHPUnit_Framework_Assert::assertSame(json_decode($data['options'], true), $project->getOptions());
PHPUnit_Framework_Assert::assertSame(json_decode($data['textmasters'], true), $project->getTextmasters());
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions Features/translation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,10 @@ Feature: Translation management
| title | description | locale |
| Hello NYC | NYC is the big apple | en |
| Bonjour NYC | NYC est la grosse pomme | fr |
When I generate a translation batch with the following parameters:
| finder | filter | name | languageFrom | languageTo | category | briefing | options | activity | textmasters |
| product | {} | PROJECT-2 | en | fr | C054 | Nothing | {"language_level": "premium"} | translation | ["55c3763e656462000b000027"] |
Then I should have the following jobs:
| id | translatable | project | document | status |
| 1 | 1 | PROJECT-1 | en-fr-1 | validated |
| 2 | 2 | PROJECT-1 | en-fr-2 | validated |

0 comments on commit 94b1abf

Please sign in to comment.