diff --git a/application/Libraries/Aauth.php b/application/Libraries/Aauth.php index 622bb91..63dc31c 100644 --- a/application/Libraries/Aauth.php +++ b/application/Libraries/Aauth.php @@ -208,7 +208,7 @@ class Aauth return true; } - $this->error($userModel->errors()); + $this->error(array_values($userModel->errors())); return false; } diff --git a/tests/Aauth/Database/UserModelTest.php b/tests/Aauth/Database/UserModelTest.php index 110c1ce..d362a67 100644 --- a/tests/Aauth/Database/UserModelTest.php +++ b/tests/Aauth/Database/UserModelTest.php @@ -95,9 +95,9 @@ class UserModelTest extends CIDatabaseTestCase public function testUpdate() { - $this->assertFalse($this->model->update(2, ['email' => 'admin@example.com'])); - print_r($this->model->errors()); - $this->assertEquals(lang('Aauth.existsAlreadyEmail'), $this->model->errors()[0]); + // $this->assertFalse($this->model->update(2, ['email' => 'admin@example.com'])); + // print_r($this->model->errors()); + // $this->assertEquals(lang('Aauth.existsAlreadyEmail'), $this->model->errors()[0]); // $this->assertFalse($this->model->update(2, ['email' => 'adminexample.com'])); // $this->assertEquals(lang('Aauth.invalidEmail'), $this->model->errors()[0]); diff --git a/tests/Aauth/Libraries/Aauth/UserTest.php b/tests/Aauth/Libraries/Aauth/UserTest.php index 46c4adf..ba79040 100644 --- a/tests/Aauth/Libraries/Aauth/UserTest.php +++ b/tests/Aauth/Libraries/Aauth/UserTest.php @@ -78,27 +78,34 @@ class UserTest extends CIDatabaseTestCase ]); $this->assertEquals(lang('Aauth.infoUpdateSuccess'), $this->library->getInfosArray()[0]); - // moved to UserModelTest, not working here :/ - // $this->assertFalse($this->library->updateUser(2, 'admin@example.com', null, null)); - // $this->assertEquals(lang('Aauth.existsAlreadyEmail'), $this->library->getErrorsArray()[0]); + $this->library = new Aauth(null, true); + $this->assertFalse($this->library->updateUser(2, 'admin@example.com', null, null)); + print_r(getErrorsArray()); + $this->assertEquals(lang('Aauth.existsAlreadyEmail'), $this->library->getErrorsArray()[0]); - // $this->assertFalse($this->library->updateUser(2, 'adminexample.com', null, null)); - // $this->assertEquals(lang('Aauth.invalidEmail'), $this->library->getErrorsArray()[0]); + $this->library = new Aauth(null, true); + $this->assertFalse($this->library->updateUser(2, 'adminexample.com', null, null)); + $this->assertEquals(lang('Aauth.invalidEmail'), $this->library->getErrorsArray()[0]); - // $this->assertFalse($this->library->updateUser(2, null, 'pass', null)); - // $this->assertEquals(lang('Aauth.invalidPassword'), $this->library->getErrorsArray()[0]); + $this->library = new Aauth(null, true); + $this->assertFalse($this->library->updateUser(2, null, 'pass', null)); + $this->assertEquals(lang('Aauth.invalidPassword'), $this->library->getErrorsArray()[0]); - // $this->assertFalse($this->library->updateUser(2, null, 'password12345678901011121314151617', null)); - // $this->assertEquals(lang('Aauth.invalidPassword'), $this->library->getErrorsArray()[0]); + $this->library = new Aauth(null, true); + $this->assertFalse($this->library->updateUser(2, null, 'password12345678901011121314151617', null)); + $this->assertEquals(lang('Aauth.invalidPassword'), $this->library->getErrorsArray()[0]); - // $this->assertFalse($this->library->updateUser(2, null, null, 'admin')); - // $this->assertEquals(lang('Aauth.existsAlreadyUsername'), $this->library->getErrorsArray()[0]); + $this->library = new Aauth(null, true); + $this->assertFalse($this->library->updateUser(2, null, null, 'admin')); + $this->assertEquals(lang('Aauth.existsAlreadyUsername'), $this->library->getErrorsArray()[0]); - // $this->assertFalse($this->library->updateUser(2, null, null, 'user+')); - // $this->assertEquals(lang('Aauth.invalidUsername'), $this->library->getErrorsArray()[0]); + $this->library = new Aauth(null, true); + $this->assertFalse($this->library->updateUser(2, null, null, 'user+')); + $this->assertEquals(lang('Aauth.invalidUsername'), $this->library->getErrorsArray()[0]); - // $this->assertFalse($this->library->updateUser(2)); - // $this->assertCount(0, $this->library->getErrorsArray()); + $this->library = new Aauth(null, true); + $this->assertFalse($this->library->updateUser(2)); + $this->assertCount(0, $this->library->getErrorsArray()); $this->library = new Aauth(null, true); $this->assertFalse($this->library->updateUser(99));