|
|
|
@ -24,10 +24,9 @@ class ErrorsTest extends \CIUnitTestCase
|
|
|
|
|
|
|
|
|
|
public function tearDown() |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected function getInstance($options=[]) |
|
|
|
|
protected function getInstance($options = []) |
|
|
|
|
{ |
|
|
|
|
$defaults = [ |
|
|
|
|
'sessionDriver' => 'CodeIgniter\Session\Handlers\FileHandler', |
|
|
|
@ -64,13 +63,12 @@ class ErrorsTest extends \CIUnitTestCase
|
|
|
|
|
public function testErrorsArray() |
|
|
|
|
{ |
|
|
|
|
$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()); |
|
|
|
|
$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->error('test message 1'); |
|
|
|
|
$this->assertEquals('test message 1', $this->library->printErrors('<br />', true)); |
|
|
|
|
$this->library->error('test message 2'); |
|
|
|
@ -83,7 +81,7 @@ class ErrorsTest extends \CIUnitTestCase
|
|
|
|
|
public function testClearErrors() |
|
|
|
|
{ |
|
|
|
|
$session = $this->getInstance(); |
|
|
|
|
$this->library = new Aauth(NULL, $session); |
|
|
|
|
$this->library = new Aauth(null, $session); |
|
|
|
|
$this->library->error('test message 1', true); |
|
|
|
|
$this->assertEquals(['test message 1'], $session->getFlashdata('errors')); |
|
|
|
|
$this->library->clearErrors(); |
|
|
|
@ -94,26 +92,26 @@ class ErrorsTest extends \CIUnitTestCase
|
|
|
|
|
public function testErrorsFlash() |
|
|
|
|
{ |
|
|
|
|
$session = $this->getInstance(); |
|
|
|
|
$this->library = new Aauth(NULL, $session); |
|
|
|
|
$this->library = new Aauth(null, $session); |
|
|
|
|
$this->assertNull($session->getFlashdata('errors')); |
|
|
|
|
$this->library->error('test message 1', true); |
|
|
|
|
$session->start(); |
|
|
|
|
$this->assertEquals(['test message 1'], $session->getFlashdata('errors')); |
|
|
|
|
|
|
|
|
|
$this->library = new Aauth(NULL, $session); |
|
|
|
|
$this->library->error(['test message 1','test message 2'], true); |
|
|
|
|
$this->library = new Aauth(null, $session); |
|
|
|
|
$this->library->error(['test message 1', 'test message 2'], true); |
|
|
|
|
$session->start(); |
|
|
|
|
$this->assertEquals(['test message 1','test message 2'], $session->getFlashdata('errors')); |
|
|
|
|
$this->assertEquals(['test message 1', 'test message 2'], $session->getFlashdata('errors')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testErrorsFlashKeep() |
|
|
|
|
{ |
|
|
|
|
$session = $this->getInstance(); |
|
|
|
|
$this->library = new Aauth(NULL, $session); |
|
|
|
|
$this->library = new Aauth(null, $session); |
|
|
|
|
$this->assertNull($session->getFlashdata('errors')); |
|
|
|
|
$this->library->error('test message 1 Flash', true); |
|
|
|
|
$session->start(); |
|
|
|
|
$this->library = new Aauth(NULL, $session); |
|
|
|
|
$this->library = new Aauth(null, $session); |
|
|
|
|
$this->library->error('test message 1 NonFlash'); |
|
|
|
|
$this->library->keepErrors(true); |
|
|
|
|
$session->start(); |
|
|
|
|