mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-03 09:57:51 +01:00
25 lines
738 B
PHP
25 lines
738 B
PHP
<?php
|
|
|
|
namespace PhpParser\ErrorHandler;
|
|
|
|
use PhpParser\Error;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class CollectingTest extends TestCase
|
|
{
|
|
public function testHandleError() {
|
|
$errorHandler = new Collecting();
|
|
$this->assertFalse($errorHandler->hasErrors());
|
|
$this->assertEmpty($errorHandler->getErrors());
|
|
|
|
$errorHandler->handleError($e1 = new Error('Test 1'));
|
|
$errorHandler->handleError($e2 = new Error('Test 2'));
|
|
$this->assertTrue($errorHandler->hasErrors());
|
|
$this->assertSame([$e1, $e2], $errorHandler->getErrors());
|
|
|
|
$errorHandler->clearErrors();
|
|
$this->assertFalse($errorHandler->hasErrors());
|
|
$this->assertEmpty($errorHandler->getErrors());
|
|
}
|
|
}
|