Browse Source

updated Aauth/ErrorsTest.php

v3-dev
REJack 6 years ago
parent
commit
ed98e64429
No known key found for this signature in database
GPG Key ID: 4A44B48700429F46
  1. 47
      tests/Aauth/Libraries/Aauth/ErrorsTest.php

47
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('<br />', true));
$this->library->error('test message 2');
$this->assertEquals('test message 1<br />test message 2', $this->library->printErrors('<br />', 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'));
}
}

Loading…
Cancel
Save