-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add validation for district in testValidate
- Loading branch information
Showing
1 changed file
with
8 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,7 +74,8 @@ public function testValidate() | |
'last_name' => 'Last name must be at least 3 characters long', | ||
'phone_no' => 'Phone number must be at least 7 characters long', | ||
'city' => 'City name must have at least 3 characters', | ||
'street' => 'Street name must have at least 4 characters' | ||
'street' => 'Street name must have at least 4 characters', | ||
'district' => 'District does not exist' | ||
], | ||
$client->validate()); | ||
|
||
|
@@ -106,26 +107,26 @@ public function testGetByEmail() | |
$fetched_client = Client::getByEmail($this->dummy_client->getEmail()); | ||
// Assert that the fetched client is not null | ||
self::assertNotNull($fetched_client); | ||
|
||
// Assert the attributes of the fetched client | ||
self::assertEquals("[email protected]", $fetched_client->getEmail()); | ||
self::assertEquals("john", $fetched_client->getFirstName()); | ||
self::assertEquals("johhny", $fetched_client->getLastName()); | ||
self::assertEquals("13213431", $fetched_client->getPhoneNo()); | ||
self::assertEquals("Royal Road, Curepipe, Moka", $fetched_client->getAddress()); | ||
|
||
// Delete the dummy record | ||
$fetched_client->deleteUser(); | ||
|
||
// Add a small delay to ensure the deletion operation is completed | ||
usleep(500000); // 500 milliseconds = 0.5 seconds | ||
|
||
// Fetch the client by email again | ||
$fetched_client = Client::getByEmail($this->dummy_client->getEmail()); | ||
|
||
// Test for invalid email | ||
// Assert that the fetched client is null or false | ||
self::assertNull($fetched_client); | ||
} | ||
|
||
} |