public function testPeekReturnsTheMostRecentlyPushedContext() { $context = new Context(); $context->push('foo'); $this->assertEquals('foo', $context->peek()); $context->push('bar'); $this->assertEquals('bar', $context->peek()); $context->pop(); $this->assertEquals('foo', $context->peek()); // TODO: remove once global state is fully deprecated (2.0) _elgg_services()->setValue('context', new Context()); elgg_push_context('foo'); $this->assertEquals('foo', elgg_get_context()); elgg_push_context('bar'); $this->assertEquals('bar', elgg_get_context()); elgg_pop_context(); $this->assertEquals('foo', elgg_get_context()); }