From d20cc43d9a7b07094c1894c5fcf89cb5e30415d5 Mon Sep 17 00:00:00 2001 From: "johan.lachenal" Date: Sat, 1 Apr 2023 15:59:44 +0200 Subject: [PATCH] Add unitary tests for the modelAdmin class --- Source/Tests/TestModel/testModelCandidat.php | 58 ++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Source/Tests/TestModel/testModelCandidat.php diff --git a/Source/Tests/TestModel/testModelCandidat.php b/Source/Tests/TestModel/testModelCandidat.php new file mode 100644 index 0000000..ead5234 --- /dev/null +++ b/Source/Tests/TestModel/testModelCandidat.php @@ -0,0 +1,58 @@ +expectException(InvalidLoginOrPasswordException::class); + + $_REQUEST['password'] = ""; + $_REQUEST['login'] = ""; + $model = new ModelCandidate(); + } + + /** + * @return void + */ + public function testInvalidePasswordArgumentLogin() { + $this->expectException(InvalidLoginOrPasswordException::class); + + $_REQUEST['password'] = "admin"; + $_REQUEST['login'] = "aze"; + $model = new ModelCandidate(); + } + + /** + * @return void + */ + public function testInvalideLoginArgumentLogin() { + $this->expectException(InvalidLoginOrPasswordException::class); + + $_REQUEST['password'] = "ad"; + $_REQUEST['login'] = "azertyuiop"; + $model = new ModelCandidate(); + } + + /** + * @return void + */ + public function testUndifineLoginArgumentLogin() { + $this->expectException(InexistantLoginException::class); + + $_REQUEST['password'] = "invalideAdmin"; + $_REQUEST['login'] = "azertyuiop"; + $model = new ModelCandidate(); + } +} \ No newline at end of file