This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
57 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace ZendTest\Ldap; | ||
|
||
use Zend\Ldap\ErrorHandler; | ||
|
||
/** | ||
* @group Zend_Ldap | ||
*/ | ||
class ErrorHandlerTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
protected $dummyErrorHandler; | ||
|
||
protected $currentErrorHandler = [ | ||
'PHPUnit_Util_ErrorHandler', | ||
'handleError', | ||
]; | ||
|
||
public function setup() | ||
{ | ||
$this->dummyErrorHandler = function ($errno, $error) {}; | ||
} | ||
public function testErrorHandlerSettingWorks() | ||
{ | ||
$errorHandler = new ErrorHandler(); | ||
|
||
$this->assertEquals($this->currentErrorHandler, set_error_handler($this->dummyErrorHandler)); | ||
$errorHandler->startErrorHandling(); | ||
$this->assertEquals($this->dummyErrorHandler, set_error_handler($this->dummyErrorHandler)); | ||
|
||
restore_error_handler(); | ||
restore_error_handler(); | ||
} | ||
|
||
public function testErrorHandlerREmovalWorks() | ||
{ | ||
$errorHandler = new ErrorHandler(); | ||
|
||
$this->assertEquals($this->currentErrorHandler, set_error_handler($this->dummyErrorHandler)); | ||
$errorHandler->stopErrorHandling(); | ||
$this->assertEquals($this->currentErrorHandler, set_error_handler($this->dummyErrorHandler)); | ||
|
||
restore_error_handler(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters