3 namespace Tests\Behat\Gherkin\Node;
5 use Behat\Gherkin\Node\ExampleTableNode;
6 use Behat\Gherkin\Node\OutlineNode;
7 use Behat\Gherkin\Node\StepNode;
9 class OutlineNodeTest extends \PHPUnit_Framework_TestCase
11 public function testCreatesExamplesForExampleTable()
14 new StepNode('Gangway!', 'I am <name>', array(), null, 'Given'),
15 new StepNode('Aye!', 'my email is <email>', array(), null, 'And'),
16 new StepNode('Blimey!', 'I open homepage', array(), null, 'When'),
17 new StepNode('Let go and haul', 'website should recognise me', array(), null, 'Then'),
20 $table = new ExampleTableNode(array(
21 array('name', 'email'),
22 array('everzet', 'ever.zet@gmail.com'),
23 array('example', 'example@example.com')
26 $outline = new OutlineNode(null, array(), $steps, $table, null, null);
28 $this->assertCount(2, $examples = $outline->getExamples());
29 $this->assertEquals(1, $examples[0]->getLine());
30 $this->assertEquals(2, $examples[1]->getLine());
31 $this->assertEquals(array('name' => 'everzet', 'email' => 'ever.zet@gmail.com'), $examples[0]->getTokens());
32 $this->assertEquals(array('name' => 'example', 'email' => 'example@example.com'), $examples[1]->getTokens());
35 public function testCreatesEmptyExamplesForEmptyExampleTable()
38 new StepNode('Gangway!', 'I am <name>', array(), null, 'Given'),
39 new StepNode('Aye!', 'my email is <email>', array(), null, 'And'),
40 new StepNode('Blimey!', 'I open homepage', array(), null, 'When'),
41 new StepNode('Let go and haul', 'website should recognise me', array(), null, 'Then'),
44 $table = new ExampleTableNode(array(
45 array('name', 'email')
48 $outline = new OutlineNode(null, array(), $steps, $table, null, null);
50 $this->assertCount(0, $examples = $outline->getExamples());
53 public function testCreatesEmptyExamplesForNoExampleTable()
56 new StepNode('Gangway!', 'I am <name>', array(), null, 'Given'),
57 new StepNode('Aye!', 'my email is <email>', array(), null, 'And'),
58 new StepNode('Blimey!', 'I open homepage', array(), null, 'When'),
59 new StepNode('Let go and haul', 'website should recognise me', array(), null, 'Then'),
62 $table = new ExampleTableNode(array(), 'Examples');
64 $outline = new OutlineNode(null, array(), $steps, $table, null, null);
66 $this->assertCount(0, $examples = $outline->getExamples());