ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ContextStackTest.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\Xml;
4
13
14 function setUp() {
15
16 $this->stack = $this->getMockForTrait('Sabre\\Xml\\ContextStackTrait');
17
18 }
19
20 function testPushAndPull() {
21
22 $this->stack->contextUri = '/foo/bar';
23 $this->stack->elementMap['{DAV:}foo'] = 'Bar';
24 $this->stack->namespaceMap['DAV:'] = 'd';
25
26 $this->stack->pushContext();
27
28 $this->assertEquals('/foo/bar', $this->stack->contextUri);
29 $this->assertEquals('Bar', $this->stack->elementMap['{DAV:}foo']);
30 $this->assertEquals('d', $this->stack->namespaceMap['DAV:']);
31
32 $this->stack->contextUri = '/gir/zim';
33 $this->stack->elementMap['{DAV:}foo'] = 'newBar';
34 $this->stack->namespaceMap['DAV:'] = 'dd';
35
36 $this->stack->popContext();
37
38 $this->assertEquals('/foo/bar', $this->stack->contextUri);
39 $this->assertEquals('Bar', $this->stack->elementMap['{DAV:}foo']);
40 $this->assertEquals('d', $this->stack->namespaceMap['DAV:']);
41
42 }
43
44}
An exception for terminatinating execution or to throw for unit testing.
Test for the ContextStackTrait.