expectOutputString('Location:/loginAdmin'); $this->assertInstanceOf(ControllerAdminAdministrators::class, $controller); } public function testDelete() { $controller = new ControllerAdminAdministrators(); $controller->delete(["id" => 1]); //$this->expectOutputString('Location:/admin/administrators'); } public function testAdd() { $controller = new ControllerAdminAdministrators(); $_SERVER['REQUEST_METHOD'] = 'POST'; $_POST['username'] = 'test'; $_POST['password'] = 'test'; $controller->add(["id" => 1]); $this->expectOutputString('Location:/admin/administrators'); $_SERVER['REQUEST_METHOD'] = 'GET'; $controller->add(["id" => 1]); $this->expectOutputString('Location:/admin/administrators'); $_SERVER['REQUEST_METHOD'] = 'POST'; $_POST['username'] = ''; $_POST['password'] = ''; $controller->add(["id" => 1]); $this->expectOutputString('Location:/admin/administrators'); $_SERVER['REQUEST_METHOD'] = 'POST'; $_POST['username'] = 'test'; $_POST['password'] = ''; $controller->add(["id" => 1]); $this->expectOutputString('Location:/admin/administrators'); $_SERVER['REQUEST_METHOD'] = 'POST'; $_POST['username'] = ''; $_POST['password'] = 'test'; $controller->add(["id" => 1]); $this->expectOutputString('Location:/admin/administrators'); } public function testUpdateModal() { $controller = new ControllerAdminAdministrators(); $controller->updateModal(["id" => 121]); $this->expectOutputString('Location:/admin/administrators'); } public function testUpdate() { $controller = new ControllerAdminAdministrators(); $_SERVER['REQUEST_METHOD'] = 'POST'; $_POST['username'] = 'test'; $_POST['password'] = 'test'; $controller->update(["id" => 1]); $this->expectOutputString('Location:/admin/administrators'); $_SERVER['REQUEST_METHOD'] = 'GET'; $controller->update(["id" => 1]); $this->expectOutputString('Location:/admin/administrators'); $_SERVER['REQUEST_METHOD'] = 'POST'; $_POST['username'] = ''; $_POST['password'] = ''; $controller->update(["id" => 1]); $this->expectOutputString('Location:/admin/administrators'); $_SERVER['REQUEST_METHOD'] = 'POST'; $_POST['username'] = 'test'; $_POST['password'] = ''; $controller->update(["id" => 1]); $this->expectOutputString('Location:/admin/administrators'); $_SERVER['REQUEST_METHOD'] = 'POST'; $_POST['username'] = ''; $_POST['password'] = 'test'; $controller->update(["id" => 1]); $this->expectOutputString('Location:/admin/administrators'); } }