Skip to content

Commit

Permalink
Cover App creation from AppFactory with empty Container
Browse files Browse the repository at this point in the history
  • Loading branch information
t0mmy742 committed Dec 28, 2020
1 parent d641d0b commit c2b59b3
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/Factory/AppFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,4 +333,37 @@ public function testCreateAppWithContainerUsesContainerDependenciesWhenPresent()
$this->assertSame($app->getRouteResolver(), $routeResolverProphecy->reveal());
$this->assertSame($app->getMiddlewareDispatcher(), $middlewareDispatcherProphecy->reveal());
}

public function testCreateAppWithEmptyContainer()
{
$containerProphecy = $this->prophesize(ContainerInterface::class);

$containerProphecy
->has(ResponseFactoryInterface::class)
->willReturn(false)
->shouldBeCalledOnce();

$containerProphecy
->has(CallableResolverInterface::class)
->willReturn(false)
->shouldBeCalledOnce();

$containerProphecy
->has(RouteCollectorInterface::class)
->willReturn(false)
->shouldBeCalledOnce();

$containerProphecy
->has(RouteResolverInterface::class)
->willReturn(false)
->shouldBeCalledOnce();

$containerProphecy
->has(MiddlewareDispatcherInterface::class)
->willReturn(false)
->shouldBeCalledOnce();

AppFactory::setSlimHttpDecoratorsAutomaticDetection(false);
AppFactory::createFromContainer($containerProphecy->reveal());
}
}

0 comments on commit c2b59b3

Please sign in to comment.