mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-20 02:25:54 +03:00
46 lines
1 KiB
PHP
46 lines
1 KiB
PHP
|
<?php
|
||
|
namespace ShlinkioTest\Shlink\Common\ErrorHandler;
|
||
|
|
||
|
use PHPUnit_Framework_TestCase as TestCase;
|
||
|
use Shlinkio\Shlink\Common\ErrorHandler\ErrorHandlerManager;
|
||
|
use Zend\ServiceManager\ServiceManager;
|
||
|
|
||
|
class ErrorHandlerManagerTest extends TestCase
|
||
|
{
|
||
|
/**
|
||
|
* @var ErrorHandlerManager
|
||
|
*/
|
||
|
protected $pluginManager;
|
||
|
|
||
|
public function setUp()
|
||
|
{
|
||
|
$this->pluginManager = new ErrorHandlerManager(new ServiceManager(), [
|
||
|
'services' => [
|
||
|
'foo' => function () {
|
||
|
},
|
||
|
],
|
||
|
'invokables' => [
|
||
|
'invalid' => \stdClass::class,
|
||
|
]
|
||
|
]);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @test
|
||
|
*/
|
||
|
public function callablesAreReturned()
|
||
|
{
|
||
|
$instance = $this->pluginManager->get('foo');
|
||
|
$this->assertInstanceOf(\Closure::class, $instance);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @test
|
||
|
* @expectedException \Zend\ServiceManager\Exception\InvalidServiceException
|
||
|
*/
|
||
|
public function nonCallablesThrowException()
|
||
|
{
|
||
|
$this->pluginManager->get('invalid');
|
||
|
}
|
||
|
}
|