bootstrap(); $plugins = $app->getPlugins(); //debug($plugins); //$this->assertCount(3, $plugins); // EP : 2 plugins en plus des standards : $this->assertCount(5, $plugins); $this->assertSame('Bake', $plugins->get('Bake')->getName()); $this->assertSame('Migrations', $plugins->get('Migrations')->getName()); $this->assertSame('DebugKit', $plugins->get('DebugKit')->getName()); // EP : mes plugins $this->assertSame('Dompdf', $plugins->get('Dompdf')->getName()); $this->assertSame('BootstrapUI', $plugins->get('BootstrapUI')->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)); } }