stack = $this->getMockForTrait('Sabre\\Xml\\ContextStackTrait'); } function testPushAndPull() { $this->stack->contextUri = '/foo/bar'; $this->stack->elementMap['{DAV:}foo'] = 'Bar'; $this->stack->namespaceMap['DAV:'] = 'd'; $this->stack->pushContext(); $this->assertEquals('/foo/bar', $this->stack->contextUri); $this->assertEquals('Bar', $this->stack->elementMap['{DAV:}foo']); $this->assertEquals('d', $this->stack->namespaceMap['DAV:']); $this->stack->contextUri = '/gir/zim'; $this->stack->elementMap['{DAV:}foo'] = 'newBar'; $this->stack->namespaceMap['DAV:'] = 'dd'; $this->stack->popContext(); $this->assertEquals('/foo/bar', $this->stack->contextUri); $this->assertEquals('Bar', $this->stack->elementMap['{DAV:}foo']); $this->assertEquals('d', $this->stack->namespaceMap['DAV:']); } }