X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fbehat%2Fgherkin%2Ftests%2FBehat%2FGherkin%2FKeywords%2FKeywordsDumperTest.php;fp=vendor%2Fbehat%2Fgherkin%2Ftests%2FBehat%2FGherkin%2FKeywords%2FKeywordsDumperTest.php;h=cf7f853a4dc6cf8ea219d40d87dffee7b61e7386;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hp=0000000000000000000000000000000000000000;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68;p=yaffs-website diff --git a/vendor/behat/gherkin/tests/Behat/Gherkin/Keywords/KeywordsDumperTest.php b/vendor/behat/gherkin/tests/Behat/Gherkin/Keywords/KeywordsDumperTest.php new file mode 100644 index 000000000..cf7f853a4 --- /dev/null +++ b/vendor/behat/gherkin/tests/Behat/Gherkin/Keywords/KeywordsDumperTest.php @@ -0,0 +1,270 @@ +keywords = new ArrayKeywords(array( + 'en' => array( + 'feature' => 'Feature', + 'background' => 'Background', + 'scenario' => 'Scenario', + 'scenario_outline' => 'Scenario Outline|Scenario Template', + 'examples' => 'Examples|Scenarios', + 'given' => 'Given', + 'when' => 'When', + 'then' => 'Then', + 'and' => 'And', + 'but' => 'But' + ), + 'ru' => array( + 'feature' => 'Функционал|Фича', + 'background' => 'Предыстория|Бэкграунд', + 'scenario' => 'Сценарий|История', + 'scenario_outline' => 'Структура сценария|Аутлайн', + 'examples' => 'Значения', + 'given' => 'Допустим', + 'when' => 'Если|@', + 'then' => 'То', + 'and' => 'И', + 'but' => 'Но' + ) + )); + } + + public function testEnKeywordsDumper() + { + $dumper = new KeywordsDumper($this->keywords); + + $dumped = $dumper->dump('en'); + $etalon = << + And there is agent + When I erase agent 's memory + Then there should be agent + But there should not be agent + + (Examples|Scenarios): + | agent1 | agent2 | + | D | M | +GHERKIN; + + $this->assertEquals($etalon, $dumped); + } + + public function testRuKeywordsDumper() + { + $dumper = new KeywordsDumper($this->keywords); + + $dumped = $dumper->dump('ru'); + $etalon = << + И there is agent + (Если|@) I erase agent 's memory + То there should be agent + Но there should not be agent + + Значения: + | agent1 | agent2 | + | D | M | +GHERKIN; + + $this->assertEquals($etalon, $dumped); + } + + public function testRuKeywordsCustomKeywordsDumper() + { + $dumper = new KeywordsDumper($this->keywords); + $dumper->setKeywordsDumperFunction(function ($keywords) { + return ''.implode(', ', $keywords).''; + }); + + $dumped = $dumper->dump('ru'); + $etalon = <<Функционал, Фича: Internal operations + In order to stay secret + As a secret organization + We need to be able to erase past agents' memory + + Предыстория, Бэкграунд: + Допустим there is agent A + И there is agent B + + Сценарий, История: Erasing agent memory + Допустим there is agent J + И there is agent K + Если, @ I erase agent K's memory + То there should be agent J + Но there should not be agent K + + Структура сценария, Аутлайн: Erasing other agents' memory + Допустим there is agent + И there is agent + Если, @ I erase agent 's memory + То there should be agent + Но there should not be agent + + Значения: + | agent1 | agent2 | + | D | M | +GHERKIN; + + $this->assertEquals($etalon, $dumped); + } + + public function testExtendedVersionDumper() + { + $dumper = new KeywordsDumper($this->keywords); + + $dumped = $dumper->dump('ru', false); + $etalon = array( + << + И there is agent + Если I erase agent 's memory + @ I erase agent 's memory + То there should be agent + Но there should not be agent + + Значения: + | agent1 | agent2 | + | D | M | + + Аутлайн: Erasing other agents' memory + Допустим there is agent + И there is agent + Если I erase agent 's memory + @ I erase agent 's memory + То there should be agent + Но there should not be agent + + Значения: + | agent1 | agent2 | + | D | M | +GHERKIN + , << + И there is agent + Если I erase agent 's memory + @ I erase agent 's memory + То there should be agent + Но there should not be agent + + Значения: + | agent1 | agent2 | + | D | M | + + Аутлайн: Erasing other agents' memory + Допустим there is agent + И there is agent + Если I erase agent 's memory + @ I erase agent 's memory + То there should be agent + Но there should not be agent + + Значения: + | agent1 | agent2 | + | D | M | +GHERKIN + ); + + $this->assertEquals($etalon, $dumped); + } +}