container = $this->makeEmpty(ContainerInterface::class, [ 'has' => true, 'get' => new PDO('pgsql:host=psql.torsten-hettstedt.net;port=5432;dbname=testdb;user=bruce;password=mypass') ]); $this->request = $this->makeEmpty(Request::class, []); $this->response = $this->makeEmpty(Response::class, [ 'getBody' => $this->makeEmpty(StreamInterface::class, [ 'write' => function (mixed $data) { $this->assertIsString($data); $this->assertJson($data); return strlen($data); }, ]), 'withHeader' => $this->makeEmpty(Response::class, [ 'withStatus' => $this->makeEmpty(Response::class), ]), ]); } /** * @throws NotDatabasesException * @throws Exception */ public function testConstructWithNonDatabase(): void { $this->container = $this->makeEmpty(ContainerInterface::class, [ 'has' => false ]); $this->expectException(NotDatabasesException::class); new WorkingHoursViewController($this->container); } /** * @throws Exception */ public function testBrowseMonthly(): void { $controller = new WorkingHoursViewController($this->container); $response = $controller->browseMonthly($this->request, $this->response, []); $this->assertInstanceOf(Response::class, $response); } /** * @throws Exception */ public function testBrowseYearly(): void { $controller = new WorkingHoursViewController($this->container); $response = $controller->browseYearly($this->request, $this->response, []); $this->assertInstanceOf(Response::class, $response); } /** * @throws Exception */ public function testBrowseWeekly(): void { $controller = new WorkingHoursViewController($this->container); $response = $controller->browseWeekly($this->request, $this->response, []); $this->assertInstanceOf(Response::class, $response); } }