1
0
Fork 0
composer/tests/Composer/Test/Util/ErrorHandlerTest.php

50 lines
1.1 KiB
PHP
Raw Normal View History

<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Test\Util;
use Composer\Util\ErrorHandler;
use Composer\Test\TestCase;
/**
* ErrorHandler test case
*
* @author Artem Lopata <biozshock@gmail.com>
*/
class ErrorHandlerTest extends TestCase
{
/**
* Test ErrorHandler handles notices
*/
public function testErrorHandlerCaptureNotice()
{
2012-03-18 20:16:36 +00:00
$this->setExpectedException('\ErrorException', 'Undefined index: baz');
2012-03-18 20:16:36 +00:00
ErrorHandler::register();
$array = array('foo' => 'bar');
$array['baz'];
}
/**
* Test ErrorHandler handles warnings
*/
public function testErrorHandlerCaptureWarning()
{
2012-03-18 20:16:36 +00:00
$this->setExpectedException('\ErrorException', 'array_merge(): Argument #2 is not an array');
2012-03-18 20:16:36 +00:00
ErrorHandler::register();
array_merge(array(), 'string');
}
}