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

ContextTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 25
rs 10
c 2
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testLeaveNodeThrowsOnEmptyStack() 0 5 1
A testTraversal() 0 13 1
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