CustomEntityRegistrar example

public function testSkipsRegistrationIfDbalIsNotConnected(): void
    {
        $connection = $this->createMock(Connection::class);
        $connection->method('isConnected')
            ->willReturn(false);
        $connection->expects(static::never())
            ->method('fetchAllAssociative');

        $container = new Container();
        $container->set(Connection::class$connection);

        $registrar = new CustomEntityRegistrar($container);

        $registrar->register();
    }

    public function testSkipsRegistrationIfFetchingCustomEntitiesFailWithException(): void
    {
        $connection = $this->createMock(Connection::class);
        $connection->method('isConnected')
            ->willReturn(true);
        $connection->expects(static::once())
            ->method('fetchAllAssociative')
            
Home | Imprint | This part of the site doesn't use cookies.