Elgg\ContextTest::testSetReplacesTheMostRecentlyPushedContext PHP Method

testSetReplacesTheMostRecentlyPushedContext() public method

    public function testSetReplacesTheMostRecentlyPushedContext()
    {
        $context = new Context();
        $context->push('foo');
        $context->set('bar');
        $this->assertNotTrue($context->contains('foo'));
        $this->assertEquals('bar', $context->pop());
        $this->assertNotEquals('foo', $context->pop());
        // TODO: remove once global state is fully deprecated (2.0)
        _elgg_services()->setValue('context', new Context());
        elgg_push_context('foo');
        elgg_set_context('bar');
        $this->assertNotTrue(elgg_in_context('foo'));
        $this->assertEquals('bar', elgg_pop_context());
        $this->assertNotEquals('foo', elgg_pop_context());
    }