Nelmio\Alice\Generator\Resolver\ResolvingContextTest::testThrowsAnExceptionWhenACircularReferenceIsDetected PHP Method

testThrowsAnExceptionWhenACircularReferenceIsDetected() public method

    public function testThrowsAnExceptionWhenACircularReferenceIsDetected()
    {
        $context = new ResolvingContext('bar');
        $context->checkForCircularReference('foo');
        $context->add('foo');
        $context->checkForCircularReference('foo');
        $context->add('foo');
        try {
            $context->checkForCircularReference('foo');
            $this->fail('Expected exception to be thrown.');
        } catch (CircularReferenceException $exception) {
            $this->assertEquals('Circular reference detected for the parameter "foo" while resolving ["bar", "foo"].', $exception->getMessage());
        }
        $context = new ResolvingContext('foo');
        $context->checkForCircularReference('foo');
        $context->add('foo');
        try {
            $context->checkForCircularReference('foo');
            $this->fail('Expected exception to be thrown.');
        } catch (CircularReferenceException $exception) {
            $this->assertEquals('Circular reference detected for the parameter "foo" while resolving ["foo"].', $exception->getMessage());
        }
    }