Failed Conditions
Branch ignore-unknown-keywords (efa676)
by Stéphane
02:58
created

ContextTest::testLeaveNodeThrowsOnEmptyStack()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 5
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the JVal package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace JVal;
11
12
class ContextTest extends \PHPUnit_Framework_TestCase
13
{
14
    /**
15
     * @expectedException \LogicException
16
     */
17
    public function testLeaveNodeThrowsOnEmptyStack()
18
    {
19
        $context = new Context();
20
        $context->leaveNode();
21
    }
22
23
    public function testTraversal()
24
    {
25
        $context = new Context();
26
        $this->assertEquals('', $context->getCurrentPath());
27
28
        $context->enterNode('foo');
29
        $context->enterNode('bar');
30
        $context->leaveNode();
31
        $this->assertEquals('/foo', $context->getCurrentPath());
32
33
        $context->enterNode('baz');
34
        $this->assertEquals('/foo/baz', $context->getCurrentPath());
35
    }
36
}
37