Elgg\ContextTest::testContainsTellsYouIfAGivenContextIsInTheCurrentStack PHP Method

testContainsTellsYouIfAGivenContextIsInTheCurrentStack() public method

    public function testContainsTellsYouIfAGivenContextIsInTheCurrentStack()
    {
        $context = new Context();
        $context->push('foo');
        $context->push('bar');
        $context->push('baz');
        $this->assertTrue($context->contains('foo'));
        $this->assertTrue($context->contains('bar'));
        $this->assertTrue($context->contains('baz'));
        $popped = $context->pop();
        $this->assertFalse($context->contains($popped));
        // TODO: remove once global state is fully deprecated (2.0)
        _elgg_services()->setValue('context', new Context());
        elgg_push_context('foo');
        elgg_push_context('bar');
        elgg_push_context('baz');
        $this->assertTrue(elgg_in_context('foo'));
        $this->assertTrue(elgg_in_context('bar'));
        $this->assertTrue(elgg_in_context('baz'));
        $popped = elgg_pop_context();
        $this->assertFalse(elgg_in_context($popped));
    }