Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

129 lines (111 sloc) 4.022 kb
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Response object tests for the Services_Amazon_SQS package.
*
* These tests require the PHPUnit 3.6 or greater package to be installed.
* PHPUnit is installable using PEAR. See the
* {@link http://www.phpunit.de/manual/3.6/en/installation.html manual}
* for detailed installation instructions.
*
* This test suite follows the PEAR AllTests conventions as documented at
* {@link http://cvs.php.net/viewvc.cgi/pear/AllTests.php?view=markup}.
*
* LICENSE:
*
* Copyright 2009-2011 silverorange
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @category Services
* @package Services_Amazon_SQS
* @author Michael Gauthier <mike@silverorange.com>
* @copyright 2009-2011 silverorange
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @version CVS: $Id$
* @link http://pear.php.net/package/Services_Amazon_SQS
* @link http://aws.amazon.com/sqs/
* @link http://s3.amazonaws.com/awsdocs/SQS/20080101/sqs-dg-20080101.pdf
*/
/**
* Services_Amazon_SQS test base class
*/
require_once dirname(__FILE__) . '/TestCase.php';
/**
* Response object tests for Services_Amazon_SQS
*
* @category Services
* @package Services_Amazon_SQS
* @author Michael Gauthier <mike@silverorange.com>
* @copyright 2009-2011 silverorange
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link http://pear.php.net/package/Services_Amazon_SQS
* @link http://aws.amazon.com/sqs/
* @link http://s3.amazonaws.com/awsdocs/SQS/20080101/sqs-dg-20080101.pdf
*/
class Services_Amazon_SQS_ResponseTestCase extends
Services_Amazon_SQS_TestCase
{
// {{{ testGetXPathWithInvalidDocument()
/**
* @group response
*/
public function testGetXPathWithInvalidDocument()
{
$body = 'This is not XML at all!';
// {{{ response headers
$headers = array(
'Content-Type' => 'text/xml',
'Transfer-Encoding' => 'chunked',
'Date' => 'Sun, 18 Jan 2009 17:34:20 GMT',
'Server' => 'AWS Simple Queue Service'
);
// }}}
$this->addHttpResponse($body, $headers);
$this->request->setUrl('http://test.example.com/');
$httpResponse = $this->request->send();
$response = new Services_Amazon_SQS_Response($httpResponse);
$xpath = $response->getXPath();
$this->assertFalse(
$xpath,
'XPath was not set to false upon reading an invalid XML response.'
);
}
// }}}
// {{{ testGetXPathWithEmptyDocument()
/**
* @group response
*/
public function testGetXPathWithEmptyDocument()
{
// {{{ response headers
$headers = array(
'Content-Type' => 'text/xml',
'Transfer-Encoding' => 'chunked',
'Date' => 'Sun, 18 Jan 2009 17:34:20 GMT',
'Server' => 'AWS Simple Queue Service'
);
// }}}
$this->addHttpResponse('', $headers);
$this->request->setUrl('http://test.example.com/');
$httpResponse = $this->request->send();
$response = new Services_Amazon_SQS_Response($httpResponse);
$xpath = $response->getXPath();
$this->assertFalse(
$xpath,
'XPath was not set to false upon reading an empty HTTP response.'
);
}
// }}}
}
?>
Jump to Line
Something went wrong with that request. Please try again.