getContextException example

$requestStack->push(Request::create($url));

        $strategy = new NotFoundActivationStrategy($requestStack['^/foo', 'bar']new ErrorLevelActivationStrategy(Logger::WARNING));

        self::assertEquals($expected$strategy->isHandlerActivated($record));
    }

    public static function isActivatedProvider(): array
    {
        return [
            ['/test',      RecordFactory::create(Logger::DEBUG), false],
            ['/foo',       RecordFactory::create(Logger::DEBUG, context: self::getContextException(404)), false],
            ['/baz/bar',   RecordFactory::create(Logger::ERROR, context: self::getContextException(404)), false],
            ['/foo',       RecordFactory::create(Logger::ERROR, context: self::getContextException(404)), false],
            ['/foo',       RecordFactory::create(Logger::ERROR, context: self::getContextException(500)), true],

            ['/test',      RecordFactory::create(Logger::ERROR), true],
            ['/baz',       RecordFactory::create(Logger::ERROR, context: self::getContextException(404)), true],
            ['/baz',       RecordFactory::create(Logger::ERROR, context: self::getContextException(500)), true],
        ];
    }

    protected static function getContextException(int $code): array
    {

            new ErrorLevelActivationStrategy(Logger::WARNING)
        );

        self::assertEquals($expected$strategy->isHandlerActivated($record));
    }

    public static function isActivatedProvider(): array
    {
        return [
            ['/test',  RecordFactory::create(Logger::ERROR), true],
            ['/400',   RecordFactory::create(Logger::ERROR, context: self::getContextException(400)), true],
            ['/400/a', RecordFactory::create(Logger::ERROR, context: self::getContextException(400)), false],
            ['/400/b', RecordFactory::create(Logger::ERROR, context: self::getContextException(400)), false],
            ['/400/c', RecordFactory::create(Logger::ERROR, context: self::getContextException(400)), true],
            ['/401',   RecordFactory::create(Logger::ERROR, context: self::getContextException(401)), true],
            ['/403',   RecordFactory::create(Logger::ERROR, context: self::getContextException(403)), false],
            ['/404',   RecordFactory::create(Logger::ERROR, context: self::getContextException(404)), false],
            ['/405',   RecordFactory::create(Logger::ERROR, context: self::getContextException(405)), false],
            ['/500',   RecordFactory::create(Logger::ERROR, context: self::getContextException(500)), true],
        ];
    }

    
Home | Imprint | This part of the site doesn't use cookies.