for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Thunder\Serializard\Tests;
use Thunder\Serializard\HandlerContainer\HandlerContainer;
/**
* @author Tomasz Kowalczyk <[email protected]>
*/
class HandlerContainerTest extends \PHPUnit_Framework_TestCase
{
public function testAlias()
$handlers = new HandlerContainer();
$handlers->add('stdClass', 'std', function() {
return 'value';
});
$handlers->addAlias('DateTime', 'stdClass');
$this->assertSame('value', call_user_func_array($handlers->getHandler('stdClass'), array()));
$this->assertSame('value', call_user_func_array($handlers->getHandler('DateTime'), array()));
}
public function testAliasForInvalidClass()
$this->setExpectedException('RuntimeException');
$handlers->addAlias('stdClass', 'DateTime');
public function testInvalidHandler()
$handlers->add('stdClass', 'name', 'invalid');