1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34:
<?php
namespace Guzzle\Tests\Parser;
use Guzzle\Parser\ParserRegistry;
class ParserRegistryTest extends \Guzzle\Tests\GuzzleTestCase
{
public function testStoresObjects()
{
$r = new ParserRegistry();
$c = new \stdClass();
$r->registerParser('foo', $c);
$this->assertSame($c, $r->getParser('foo'));
}
public function testReturnsNullWhenNotFound()
{
$r = new ParserRegistry();
$this->assertNull($r->getParser('FOO'));
}
public function testReturnsLazyLoadedDefault()
{
$r = new ParserRegistry();
$c = $r->getParser('cookie');
$this->assertInstanceOf('Guzzle\Parser\Cookie\CookieParser', $c);
$this->assertSame($c, $r->getParser('cookie'));
}
}