diff --git a/tests/Aauth/Libraries/Aauth/ErrorsTest.php b/tests/Aauth/Libraries/Aauth/ErrorsTest.php index 52c0d58..f7b628a 100644 --- a/tests/Aauth/Libraries/Aauth/ErrorsTest.php +++ b/tests/Aauth/Libraries/Aauth/ErrorsTest.php @@ -58,15 +58,46 @@ class ErrorsTest extends \CIUnitTestCase $this->library = new Aauth(NULL, TRUE); $this->assertCount(0, $this->library->getErrorsArray()); $this->library->error('test message 1'); - $this->assertCount(1, $this->library->getErrorsArray()); + $this->assertEquals(['test message 1'], $this->library->getErrorsArray()); } - public function testgetErrorsArray() + public function testErrorsArray() { $this->library = new Aauth(NULL, TRUE); $this->assertCount(0, $this->library->getErrorsArray()); + $this->library->error(['test message 1','test message 2']); + $this->assertEquals(['test message 1','test message 2'], $this->library->getErrorsArray()); + } + + public function testPrintErrors() + { + $this->library = new Aauth(NULL, TRUE); $this->library->error('test message 1'); - $this->assertCount(1, $this->library->getErrorsArray()); + $this->assertEquals('test message 1', $this->library->printErrors('
', true)); + $this->library->error('test message 2'); + $this->assertEquals('test message 1
test message 2', $this->library->printErrors('
', true)); + } + + public function testClearErrors() + { + $session = $this->getInstance(); + $this->library = new Aauth(NULL, $session); + $this->library->error('test message 1', true); + $this->assertEquals(['test message 1'], $session->get('errors')); + $this->library->clearErrors(); + $this->assertNull($session->get('errors')); + } + + public function testKeepErrorsInclude() + { + $session = $this->getInstance(); + $this->library = new Aauth(NULL, $session); + $this->library->error('test message 1 nonFlash'); + $this->assertNull($session->get('errors')); + $this->library->error('test message 1 Flash', true); + $this->assertEquals(['test message 1 Flash'], $session->get('errors')); + $this->library->keepErrors(true); + $this->assertEquals(['test message 1 Flash', 'test message 1 nonFlash'], $session->get('errors')); } public function testErrorsFlash() @@ -75,7 +106,15 @@ class ErrorsTest extends \CIUnitTestCase $this->library = new Aauth(NULL, $session); $this->assertNull($session->get('errors')); $this->library->error('test message 1', true); - print_r($session->get('errors')); $this->assertEquals(['test message 1'], $session->get('errors')); } + + public function testErrorsFlashArray() + { + $session = $this->getInstance(); + $this->library = new Aauth(NULL, $session); + $this->assertNull($session->get('errors')); + $this->library->error(['test message 1','test message 2'], true); + $this->assertEquals(['test message 1','test message 2'], $session->get('errors')); + } }