Пример #1
0
 /**
  * @param BackgroundNode $background
  *
  * @return string
  */
 public function format(BackgroundNode $background)
 {
     $shortDesc = $this->getBackgroundShortDescription($background) . "\n";
     $step = new Step($this->align);
     $steps = $step->format($background->getSteps());
     return $this->indent() . $shortDesc . $steps;
 }
Пример #2
0
 /**
  * @param ScenarioInterface $scenario
  *
  * @return string|void
  */
 private function getSteps(ScenarioInterface $scenario)
 {
     if (!$scenario->hasSteps()) {
         return;
     }
     $step = new Step($this->align);
     return $step->format($scenario->getSteps()) . "\n";
 }
Пример #3
0
    public function testCanFormatStepsWithPyString()
    {
        $this->formatter = new Step(Step::ALIGN_TO_LEFT);
        $expected = <<<EOS
        Given I am a Java programmer
        And I am not Kawaii
        When I start to contribute to a php project:
        """
          This is a pyString
          Multi-line :D

          Meh... kawaii hu!?
        """
        Then I start to love php
        When I go to a php events
        Then I start to become a Kawaii guy

EOS;
        $tableNode = new PyStringNode(['This is a pyString', 'Multi-line :D', '', 'Meh... kawaii hu!?'], 1);
        $scenario = new ScenarioNode(' Not all people who program php are becoming kawaii ', [' kawaii ', ' kawaii-bug-12 '], [new StepNode('Given', '       I am a Java programmer ', [], 1, 'Given'), new StepNode('And', '  I am not Kawaii ', [], 2, 'And'), new StepNode('When', '  I start to contribute to a php project: ', [$tableNode], 3, 'And'), new StepNode('Then', '  I start to love php ', [], 4, 'And'), new StepNode('When', ' I go to a php events ', [], 5, 'And'), new StepNode('Then', 'I start to become a Kawaii guy ', [], 5, 'And')], 'Scenario', 1);
        self::assertSame($expected, $this->formatter->format($scenario->getSteps()));
    }