From 8cdd2f2bbee2ed4a7bd95d021c5a9c0cfcfebbb4 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Sun, 18 Jun 2023 18:32:58 +0300 Subject: [PATCH] Add tests for the Company validations. --- tests/Feature/CompanyTest.php | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/Feature/CompanyTest.php diff --git a/tests/Feature/CompanyTest.php b/tests/Feature/CompanyTest.php new file mode 100644 index 0000000..aaea546 --- /dev/null +++ b/tests/Feature/CompanyTest.php @@ -0,0 +1,39 @@ +assertEquals($json['error'], 'The company name is empty, please, write the name!!!'); + } + + public function test_not_existing_company_with_name(): void + { + $name = '404 Company'; + + $json = Company::validate_with_name($name); + + $this->assertEquals($json['error'], 'A company with the name does not exist!!!'); + } + + public function test_valid_company_with_name(): void + { + $name = 'testCompany'; + + $json = Company::validate_with_name($name); + + $this->assertEquals($json['ok'], 'A company with the name is valid.'); + } +}