bootstrap(); $plugins = $app->getPlugins(); $this->assertCount(3, $plugins); $this->assertSame('Bake', $plugins->get('Bake')->getName()); $this->assertSame('Migrations', $plugins->get('Migrations')->getName()); $this->assertSame('DebugKit', $plugins->get('DebugKit')->getName()); } /** * testBootstrapPluginWitoutHalt * * @return void */ public function testBootstrapPluginWithoutHalt() { $this->expectException(InvalidArgumentException::class); $app = $this->getMockBuilder(Application::class) ->setConstructorArgs([dirname(dirname(__DIR__)) . '/config']) ->setMethods(['addPlugin']) ->getMock(); $app->method('addPlugin') ->will($this->throwException(new InvalidArgumentException('test exception.'))); $app->bootstrap(); } /** * testMiddleware * * @return void */ public function testMiddleware() { $app = new Application(dirname(dirname(__DIR__)) . '/config'); $middleware = new MiddlewareQueue(); $middleware = $app->middleware($middleware); $this->assertInstanceOf(ErrorHandlerMiddleware::class, $middleware->get(0)); $this->assertInstanceOf(AssetMiddleware::class, $middleware->get(1)); $this->assertInstanceOf(RoutingMiddleware::class, $middleware->get(2)); } }