bootstrap(); $plugins = $app->getPlugins(); $this->assertSame('Bake', $plugins->get('Bake')->getName()); $this->assertSame('DebugKit', $plugins->get('DebugKit')->getName()); $this->assertSame('Migrations', $plugins->get('Migrations')->getName()); $this->assertSame('Authentication', $plugins->get('Authentication')->getName()); $this->assertSame('ADmad/SocialAuth', $plugins->get('ADmad/SocialAuth')->getName()); $this->assertSame('Tags', $plugins->get('Tags')->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->current()); $middleware->seek(1); $this->assertInstanceOf(AssetMiddleware::class, $middleware->current()); $middleware->seek(2); $this->assertInstanceOf(RoutingMiddleware::class, $middleware->current()); } }