Fix ErrorHandler sliceErrors not returning errors
Signed-off-by: Craig McNeill <craig@mmddata.ca>
This commit is contained in:
parent
7b77d07622
commit
af835bc52c
@ -160,7 +160,7 @@ class ErrorHandler
|
||||
$errors = $this->getErrors(false);
|
||||
$this->errors = array_splice($errors, 0, $count);
|
||||
|
||||
return array_splice($errors, $count);
|
||||
return $errors;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -181,6 +181,12 @@ class ErrorHandlerTest extends AbstractTestCase
|
||||
*/
|
||||
public function testSliceErrors(): void
|
||||
{
|
||||
$this->object->addError(
|
||||
'Compile Error',
|
||||
E_WARNING,
|
||||
'error.txt',
|
||||
15
|
||||
);
|
||||
$this->object->addError(
|
||||
'Compile Error',
|
||||
E_WARNING,
|
||||
@ -188,23 +194,23 @@ class ErrorHandlerTest extends AbstractTestCase
|
||||
15
|
||||
);
|
||||
$this->assertEquals(
|
||||
1,
|
||||
2,
|
||||
$this->object->countErrors()
|
||||
);
|
||||
$this->assertEquals(
|
||||
[],
|
||||
$this->object->sliceErrors(1)
|
||||
$this->object->sliceErrors(2)
|
||||
);
|
||||
$this->assertEquals(
|
||||
1,
|
||||
2,
|
||||
$this->object->countErrors()
|
||||
);
|
||||
$this->assertCount(
|
||||
1,
|
||||
$this->object->sliceErrors(0)
|
||||
$this->object->sliceErrors(1)
|
||||
);
|
||||
$this->assertEquals(
|
||||
0,
|
||||
1,
|
||||
$this->object->countErrors()
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user