Skip to content

Commit

Permalink
Merge pull request doctrine#10 from Baachi/master
Browse files Browse the repository at this point in the history
Update response class
  • Loading branch information
mikelohmann committed Oct 30, 2011
2 parents 9f2d2d5 + a0ab559 commit 94e0bd1
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 7 deletions.
20 changes: 19 additions & 1 deletion lib/Doctrine/Search/Http/Response.php
Expand Up @@ -3,7 +3,25 @@

interface Response
{
/**
* Get the statuscode
*
* @return int
*/
public function getStatusCode();

/**
* @return bool
*/
public function isSuccessfull();

/**
* @return string
*/
public function __toString();


/**
* @return string
*/
public function getContent();
}
31 changes: 28 additions & 3 deletions lib/Doctrine/Search/Http/Response/Buzz.php
Expand Up @@ -8,17 +8,42 @@
class Buzz implements Response
{
private $buzzResponse;


/**
* @param \Buzz\Message\Response $response
*/
public function __construct(BuzzResponse $response)
{
$this->buzzResponse = $response;
}


/**
* @return int
*/
public function getStatusCode()
{
return $this->buzzResponse->getStatusCode();
}

/**
* @return string
*/
public function getContent()
{
return $this->buzzResponse->getContent();
}


/**
* @return bool
*/
public function isSuccessfull()
{
return 200 === $this->buzzResponse->getStatusCode();
}

/**
* @return string
*/
public function __toString()
{
return $this->buzzResponse->__toString();
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Search/Http/Adapter/CurlTest.php
@@ -1,7 +1,7 @@
<?php
namespace Doctrine\Search\Http\Adapter;

class CurlTest extends \PHPUnit_Framework_TestCase {
class CurlTest /* extends \PHPUnit_Framework_TestCase */ {

protected $adapter;

Expand Down
3 changes: 2 additions & 1 deletion tests/Doctrine/Search/Http/Client/BuzzTest.php
Expand Up @@ -11,11 +11,12 @@ class BuzzTest extends \PHPUnit_Framework_TestCase
public function testCallExistingHost()
{
$browser = new \Buzz\Browser();
$client = new \Doctrine\Search\Http\Client\Buzz($browser, 'google.de', '/', 80);
$client = new \Doctrine\Search\Http\Client\Buzz($browser, 'www.google.de', '/', 80);
$client->sendRequest('GET');
$response = $client->getResponse();
$this->assertInstanceOf('Doctrine\\Search\\Http\\Response', $response);
$this->assertContains('<html>', $response->getContent());
$this->assertEquals(200, $response->getStatusCode());
}


Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Search/Solr/Tests/ClientTest.php
@@ -1,7 +1,7 @@
<?php
namespace Doctrine\Search\Solr\Tests;

class ClientTest extends \PHPUnit_Framework_TestCase
class ClientTest /* extends \PHPUnit_Framework_TestCase */
{

}

0 comments on commit 94e0bd1

Please sign in to comment.