123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace Composer\Test\Util;
- use Composer\Util\ErrorHandler;
- use Composer\Test\TestCase;
- class ErrorHandlerTest extends TestCase
- {
- public function setUp()
- {
- ErrorHandler::register();
- }
- public function tearDown()
- {
- restore_error_handler();
- }
-
- public function testErrorHandlerCaptureNotice()
- {
- $this->setExpectedException('\ErrorException', 'Undefined index: baz');
- $array = array('foo' => 'bar');
- $array['baz'];
- }
-
- public function testErrorHandlerCaptureWarning()
- {
- if (PHP_VERSION_ID >= 80000) {
- $this->setExpectedException('TypeError', 'array_merge');
- } else {
- $this->setExpectedException('ErrorException', 'array_merge');
- }
- array_merge(array(), 'string');
- }
-
- public function testErrorHandlerRespectsAtOperator()
- {
- @trigger_error('test', E_USER_NOTICE);
- }
- }
|