From cd57da8ead0fe4821effc6ad9d91071582d6f73d Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 20 Jul 2023 01:42:42 +0400 Subject: [PATCH] fix: update tests --- src/Appwrite/Auth/Validator/PersonalData.php | 4 ++++ tests/unit/Auth/Validator/PersonalDataTest.php | 10 +++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Appwrite/Auth/Validator/PersonalData.php b/src/Appwrite/Auth/Validator/PersonalData.php index 46cdd09b69..6f8ed0a8c9 100644 --- a/src/Appwrite/Auth/Validator/PersonalData.php +++ b/src/Appwrite/Auth/Validator/PersonalData.php @@ -37,6 +37,10 @@ class PersonalData extends Password */ public function isValid($password): bool { + if (!parent::isValid($password)) { + return false; + } + if (!$this->strict) { $password = strtolower($password); $this->userId = strtolower($this->userId); diff --git a/tests/unit/Auth/Validator/PersonalDataTest.php b/tests/unit/Auth/Validator/PersonalDataTest.php index 5a27f93c0b..1da5c458c0 100644 --- a/tests/unit/Auth/Validator/PersonalDataTest.php +++ b/tests/unit/Auth/Validator/PersonalDataTest.php @@ -42,6 +42,9 @@ class PersonalDataTest extends TestCase $this->assertEquals($this->object->isValid('something.email'), false); $this->assertEquals($this->object->isValid('email.something'), false); $this->assertEquals($this->object->isValid('something.email.something'), false); + + /** Test for success */ + $this->assertEquals($this->object->isValid('893pu5egerfsv3rgersvd'), true); } public function testNotStrict(): void @@ -75,11 +78,4 @@ class PersonalDataTest extends TestCase $this->assertEquals($this->object->isValid('EMAIL.something'), false); $this->assertEquals($this->object->isValid('something.EMAIL.something'), false); } - - public function testSuccess(): void - { - $this->object = new PersonalData('userId', 'email@example.com', 'name', '+129492323', false); - $this->assertEquals($this->object->isValid('foo'), true); - $this->assertEquals($this->object->isValid('bar'), true); - } }