1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-26 02:53:22 +01:00
guzzle/tests/Guzzle/Tests/Http/Parser/ParserRegistryTest.php
Michael Dowling 764d935694 Changes to support a Guzzle\Http\Parser namespace
[Common] Adding keySearch method to Collection
[Http] Moving POST curl option logic from EntityEnclosingRequest to the
curl factory method
Directly using the HTTP request object when creating curl handles in the
factory method
No longer adding a read callback when sending POSTs through
CURLOPT_POSTFIELDS
In an effort to mitigate random segfaults and bus errors, using a queue
for removing curl and close handles from a multi object so that they are
only removed when the multi handle has finished sending all requests.
Calling reset() each time a curl multi handle has finished all requests.
EntityEnclosingRequest::getPostFields() now returns a Collection object
Simplifying the EntityEnclosingRequest::getPostFiles method
Adding an array cache to header objects
Moving the header comparison DSL from the Tests namespace to
Guzzle\Http\Message\HeaderComparison, and adding tests.
Adding message, cookie, and url parser interfaces and default
implementations.
Using a parser registry to manage globally registered parsers.  Removing parsing from Response and RequestFactory.
Renaming protocol_version to version
Changing the Guzzle\Http\Message\Response::setProtocol() method to accept a protocol and version in separate args.
Simplifying the chunked encoding handling in RequestFactory
Moving cookie parsing out of the cookie plugin and into Guzzle\Http\Parser\Cookie\CookieParser
Removing regexps from the cookie parser and simply using stripos
Moving the parseQuery method out of Url and on to QueryString::fromString() as a static factory method.
Adding more logging to node.js test webserver
Adding pecl_http message parser.
Installing pecl when travis boots up
2012-05-13 01:23:32 -07:00

37 lines
1017 B
PHP

<?php
namespace Guzzle\Tests\Http\Parser;
use Guzzle\Http\Parser\ParserRegistry;
/**
* Guzzle\Http\Parser\ParserRegistry
*/
class ParserRegistryTest extends \Guzzle\Tests\GuzzleTestCase
{
public function testStoresObjects()
{
$c = new \stdClass();
ParserRegistry::set('foo', $c);
$this->assertSame($c, ParserRegistry::get('foo'));
}
public function testReturnsNullWhenNotFound()
{
$this->assertNull(ParserRegistry::get('FOO'));
}
public function testReturnsLazyLoadedDefault()
{
// Clear out what might be cached
$refObject = new \ReflectionClass('Guzzle\Http\Parser\ParserRegistry');
$refProperty = $refObject->getProperty('instances');
$refProperty->setAccessible(true);
$refProperty->setValue(null, array());
$c = ParserRegistry::get('cookie');
$this->assertInstanceOf('Guzzle\Http\Parser\Cookie\CookieParser', $c);
$this->assertSame($c, ParserRegistry::get('cookie'));
}
}