diff --git a/Source/Tests/TestController/ControllerAdminTest.php b/Source/Tests/TestController/ControllerAdminTest.php deleted file mode 100644 index 2346825..0000000 --- a/Source/Tests/TestController/ControllerAdminTest.php +++ /dev/null @@ -1,100 +0,0 @@ -expectException(InvalidArgumentException::class); - $controller->addQuestion(); - } - - /** - * @throws Exception - * @throws \Exception - */ - public function testAddQuestionCallsModelAdminAndGoesToQuestionsWhenTypeIsTextQuestion() - { - $modelMock = $this->createMock(ModelAdmin::class); - $modelMock->expects($this->once())->method('addQuestion'); - $controller = new ControllerAdmin(); - $controller->goToQuestions = $this->createMock(stdClass::class); // mock the method - $_POST['type'] = 'BusinessClass\TextQuestion'; - $controller->addQuestion(); - } - - /** - * @throws Exception - * @throws \Exception - */ - public function testAddQuestionCallsModelAdminAndRequiresPossibleResponsesFormWhenTypeIsNotTextQuestion() - { - $modelMock = $this->createMock(ModelAdmin::class); - $modelMock->expects($this->once())->method('addQuestion'); - $modelMock->expects($this->once())->method('getCategories'); - $controller = new ControllerAdmin(); - $controller->goToQuestions = $this->createMock(stdClass::class); // mock the method - $_POST['type'] = 'BusinessClass\OtherQuestion'; - $GLOBALS['rep'] = 'path/to/'; - $GLOBALS['views'] = ['possibleResponsesForm' => 'path/to/possibleResponsesForm.php']; - $this->expectOutputString(file_get_contents('path/to/possibleResponsesForm.php')); - $controller->addQuestion(); - } - - /** - * @throws \Exception - */ - public function testAddResponseThrowsExceptionWhenParametersAreMissing() - { - $controller = new ControllerAdmin(); - $_POST = []; - $this->expectException(InvalidArgumentException::class); - $controller->addResponse(); - } - - /** - * @throws Exception - * @throws \Exception - */ - public function testAddResponseCallsModelAdminAndRequiresContinueWhenParametersAreValid() - { - $modelMock = $this->createMock(ModelAdmin::class); - $modelMock->expects($this->once())->method('addResponse'); - $modelMock->expects($this->once())->method('getCategories'); - $controller = new ControllerAdmin(); - $GLOBALS['rep'] = 'path/to/'; - $GLOBALS['views'] = ['continue' => 'path/to/continue.php']; - $_POST['idQuestion'] = '123'; - $_POST['question'] = 'What is the meaning of life?'; - $_POST['type'] = 'BusinessClass\OtherQuestion'; - $this->expectOutputString(file_get_contents('path/to/continue.php')); - $controller->addResponse(); - } - - /** - * @throws \Exception - */ - public function testContinueResponseThrowsExceptionWhenParametersAreMissing() - { - $controller = new ControllerAdmin(); - $_POST = []; - $this->expectException(InvalidArgumentException::class); - $controller->continueResponse(); - - } -} - diff --git a/Source/Tests/TestController/ControllerCandidateTest.php b/Source/Tests/TestController/ControllerCandidateTest.php deleted file mode 100644 index 3dd6f76..0000000 --- a/Source/Tests/TestController/ControllerCandidateTest.php +++ /dev/null @@ -1,104 +0,0 @@ -controller = new ControllerCandidate(); - } - - /** - * @throws \PHPUnit\Framework\MockObject\Exception - * @throws Exception - */ - public function testGoToForm(): void - { - $modelMock = $this->createMock(ModelCandidate::class); - $modelMock->expects($this->once()) - ->method('getForm') - ->willReturn('
'); - $this->controller->goToForm(); - $this->expectOutputRegex('/