mirror of
https://github.com/guzzle/guzzle.git
synced 2025-02-26 02:53:22 +01:00
34 lines
811 B
PHP
34 lines
811 B
PHP
<?php
|
|
|
|
namespace Guzzle\Tests\Parser;
|
|
|
|
use Guzzle\Parser\ParserRegistry;
|
|
|
|
/**
|
|
* @covers 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'));
|
|
}
|
|
}
|