container = $this->createMock(InflectableContainer::class); $this->application = new Application($this->container); } public function testCallsAllBootstrappersInOrder(): void { $bootstrapper1 = $this->createMock(BootstrapperInterface::class); $bootstrapper2 = $this->createMock(BootstrapperInterface::class); $callOrder = []; $bootstrapper1->expects(self::once())->method('bootstrap')->with($this->container)->willReturnCallback( function () use (&$callOrder): void { $callOrder[] = 'bootstrapper1'; }, ); $bootstrapper2->expects(self::once())->method('bootstrap')->with($this->container)->willReturnCallback( function () use (&$callOrder): void { $callOrder[] = 'bootstrapper2'; }, ); $this->application->addBootstrapper($bootstrapper1); $this->application->addBootstrapper($bootstrapper2); $this->application->bootstrap(); self::assertSame(['bootstrapper1', 'bootstrapper2'], $callOrder); } public function testStartsHttpKernel(): void { $httpKernel = $this->createMock(HttpKernel::class); $this->container->expects(self::once())->method('get')->with(HttpKernel::class)->willReturn($httpKernel); $httpKernel->expects(self::once())->method('handle'); $this->application->run(); } public function testGetContainerReturnsInjectedContainer(): void { self::assertSame($this->container, $this->application->getContainer()); } }