Пример #1
0
 /**
  * Dumps a background.
  *
  * @param BackgroundNode $background Background instance
  *
  * @return string
  */
 public function dumpBackground(BackgroundNode $background)
 {
     $content = $this->dumpKeyword($this->keywords->getBackgroundKeywords(), $background->getTitle());
     foreach ($background->getSteps() as $step) {
         $content .= PHP_EOL . $this->dumpIndent(1) . $this->dumpStep($step);
     }
     return $content;
 }
 public function testSteps()
 {
     $background = new BackgroundNode();
     $this->assertEquals(0, count($background->getSteps()));
     $this->assertFalse($background->hasSteps());
     $background->addStep(new StepNode('Given', 'Something'));
     $this->assertEquals(1, count($background->getSteps()));
     $this->assertTrue($background->hasSteps());
     $background->addStep(new StepNode('Then', 'Do'));
     $this->assertEquals(2, count($background->getSteps()));
     $this->assertTrue($background->hasSteps());
     $steps = $background->getSteps();
     $this->assertInstanceOf('Behat\\Gherkin\\Node\\StepNode', $steps[0]);
     $this->assertEquals('Given', $steps[0]->getType());
     $this->assertEquals('Something', $steps[0]->getText());
     $this->assertSame($background, $steps[0]->getParent());
     $this->assertEquals('Then', $steps[1]->getType());
     $this->assertEquals('Do', $steps[1]->getText());
     $this->assertSame($background, $steps[1]->getParent());
 }