diff options
author | Michal Čihař <michal@cihar.com> | 2016-04-18 17:30:01 +0300 |
---|---|---|
committer | Michal Čihař <michal@cihar.com> | 2016-04-18 17:30:01 +0300 |
commit | 57dce340852178299c29d64bd87ae481047afa70 (patch) | |
tree | 0d3919c06be9fb6b6345d2a410bc6ad00336c1b7 /test/classes/ErrorHandlerTest.php | |
parent | 8bf08611da30aaa2af191b526a63128513d152a0 (diff) | |
parent | 4e0ca4601de48412b93cad230957ee4b5a94c3ba (diff) |
Merge branch 'QA_4_6'
Diffstat (limited to 'test/classes/ErrorHandlerTest.php')
-rw-r--r-- | test/classes/ErrorHandlerTest.php | 61 |
1 files changed, 46 insertions, 15 deletions
diff --git a/test/classes/ErrorHandlerTest.php b/test/classes/ErrorHandlerTest.php index b50b4d9ab4..ddc4406f87 100644 --- a/test/classes/ErrorHandlerTest.php +++ b/test/classes/ErrorHandlerTest.php @@ -180,14 +180,43 @@ class ErrorHandlerTest extends PMATestCase */ public function testCountErrors() { + $this->object->addError( + 'Compile Error', E_WARNING, 'error.txt', 15 + ); + $this->assertEquals( + 1, + $this->object->countErrors() + ); + } - $err = array(); - $err[] = new PMA\libraries\Error('256', 'Compile Error', 'error.txt', 15); - $errHandler = $this->getMock('PMA\libraries\ErrorHandler'); - $errHandler->expects($this->any()) - ->method('getErrors') - ->will($this->returnValue($err)); - + /** + * Test for sliceErrors + * + * @return void + * + * @group medium + */ + public function testSliceErrors() + { + $this->object->addError( + 'Compile Error', E_WARNING, 'error.txt', 15 + ); + $this->assertEquals( + 1, + $this->object->countErrors() + ); + $this->assertEquals( + array(), + $this->object->sliceErrors(1) + ); + $this->assertEquals( + 1, + $this->object->countErrors() + ); + $this->assertEquals( + 1, + count($this->object->sliceErrors(0)) + ); $this->assertEquals( 0, $this->object->countErrors() @@ -201,18 +230,20 @@ class ErrorHandlerTest extends PMATestCase */ public function testCountUserErrors() { - - $err = array(); - $err[] = new PMA\libraries\Error('256', 'Compile Error', 'error.txt', 15); - $errHandler = $this->getMock('PMA\libraries\ErrorHandler'); - $errHandler->expects($this->any()) - ->method('countErrors', 'getErrors') - ->will($this->returnValue(1, $err)); - + $this->object->addError( + 'Compile Error', E_WARNING, 'error.txt', 15 + ); $this->assertEquals( 0, $this->object->countUserErrors() ); + $this->object->addError( + 'Compile Error', E_USER_WARNING, 'error.txt', 15 + ); + $this->assertEquals( + 1, + $this->object->countUserErrors() + ); } /** |