Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Commit

Permalink
Merge pull request #1756 from elkuku/unit-tests-fix-01
Browse files Browse the repository at this point in the history
Fix unit tests for PHP 5.4
  • Loading branch information
pasamio committed Dec 16, 2012
2 parents e6a697e + a97d856 commit 5f6f62a
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/suites/unit/joomla/google/JGoogleDataAdsenseTest.php
Expand Up @@ -380,6 +380,8 @@ public function testExceptions()
*/
function jsonAdsenseCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/json');
$response->body = '{"items":{"1":1,"2":2},"nextPageToken":"1234"}';
Expand All @@ -400,6 +402,8 @@ function jsonAdsenseCallback($url, array $headers = null, $timeout = null)
*/
function jsonAdsenseReportCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/json');
$response->body = '{"rows":{"0":1,"1":2},"totalMatchedRows":1}';
Expand All @@ -420,6 +424,8 @@ function jsonAdsenseReportCallback($url, array $headers = null, $timeout = null)
*/
function adsenseExceptionCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/json');
$response->body = 'BADDATA';
Expand Down
12 changes: 12 additions & 0 deletions tests/suites/unit/joomla/google/JGoogleDataCalendarTest.php
Expand Up @@ -489,6 +489,8 @@ public function testExceptions()
*/
function jsonDataCalendarCallback($url, $data, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/json');
$response->body = '{"items":{"1":1,"2":2}}';
Expand All @@ -510,6 +512,8 @@ function jsonDataCalendarCallback($url, $data, array $headers = null, $timeout =
*/
function emptyDataCalendarCallback($url, $data, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'text/html');
$response->body = '';
Expand All @@ -530,6 +534,8 @@ function emptyDataCalendarCallback($url, $data, array $headers = null, $timeout
*/
function jsonCalendarCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/json');
$response->body = '{"items":{"1":1,"2":2}}';
Expand All @@ -550,6 +556,8 @@ function jsonCalendarCallback($url, array $headers = null, $timeout = null)
*/
function emptyCalendarCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'text/html');
$response->body = '';
Expand All @@ -570,6 +578,8 @@ function emptyCalendarCallback($url, array $headers = null, $timeout = null)
*/
function calendarExceptionCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/json');
$response->body = 'BADDATA';
Expand All @@ -591,6 +601,8 @@ function calendarExceptionCallback($url, array $headers = null, $timeout = null)
*/
function calendarDataExceptionCallback($url, $data, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/json');
$response->body = 'BADDATA';
Expand Down
Expand Up @@ -477,6 +477,8 @@ public function testExceptions()
*/
function emptyPicasaCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/atom+xml');
$response->body = '';
Expand All @@ -497,6 +499,8 @@ function emptyPicasaCallback($url, array $headers = null, $timeout = null)
*/
function picasaPhotolistCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/atom+xml');
$response->body = JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'photolist.txt');
Expand All @@ -518,6 +522,8 @@ function picasaPhotolistCallback($url, array $headers = null, $timeout = null)
*/
function dataPicasaUploadCallback($url, $data, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/atom+xml');
$response->body = JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'photo.txt');
Expand Down
Expand Up @@ -422,6 +422,8 @@ public function testExceptions()
*/
function picasaPhotoCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/atom+xml');
$response->body = JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'photo.txt');
Expand All @@ -445,6 +447,8 @@ function dataPicasaPhotoCallback($url, $data, array $headers = null, $timeout =
{
PHPUnit_Framework_TestCase::assertContains('<title>New Title</title>', $data);

$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/atom+xml');
$response->body = $data;
Expand Down
12 changes: 12 additions & 0 deletions tests/suites/unit/joomla/google/JGoogleDataPicasaTest.php
Expand Up @@ -262,6 +262,8 @@ public function testExceptions()
*/
function picasaAlbumCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'text/html');
$response->body = JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'album.txt');
Expand All @@ -285,6 +287,8 @@ function dataPicasaAlbumCallback($url, $data, array $headers = null, $timeout =
{
PHPUnit_Framework_TestCase::assertContains('<title>New Title</title>', $data);

$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/atom+xml');
$response->body = $data;
Expand All @@ -305,6 +309,8 @@ function dataPicasaAlbumCallback($url, $data, array $headers = null, $timeout =
*/
function picasaAlbumlistCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/atom+xml');
$response->body = JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'albumlist.txt');
Expand All @@ -325,6 +331,8 @@ function picasaAlbumlistCallback($url, array $headers = null, $timeout = null)
*/
function picasaExceptionCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/atom+xml');
$response->body = 'BADDATA';
Expand All @@ -346,6 +354,8 @@ function picasaExceptionCallback($url, array $headers = null, $timeout = null)
*/
function picasaDataExceptionCallback($url, $data, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/atom+xml');
$response->body = 'BADDATA';
Expand All @@ -366,6 +376,8 @@ function picasaDataExceptionCallback($url, $data, array $headers = null, $timeou
*/
function picasaBadXmlCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/atom+xml');
$response->body = '<feed />';
Expand Down
6 changes: 6 additions & 0 deletions tests/suites/unit/joomla/google/JGoogleEmbedMapsTest.php
Expand Up @@ -759,6 +759,8 @@ function mapsGeocodeCallback($url, array $headers = null, $timeout = null)
$data = "{\n \"results\" : [],\n \"status\" : \"ZERO_RESULTS\"\n}\n";
}

$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/json');
$response->body = $data;
Expand All @@ -779,6 +781,8 @@ function mapsGeocodeCallback($url, array $headers = null, $timeout = null)
*/
function mapsGeocode400Callback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 400;
$response->headers = array('Content-Type' => 'application/json');
$response->body = '';
Expand All @@ -799,6 +803,8 @@ function mapsGeocode400Callback($url, array $headers = null, $timeout = null)
*/
function mapsGeocodeBadJsonCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/json');
$response->body = 'BADDATA';
Expand Down
7 changes: 7 additions & 0 deletions tests/suites/unit/joomla/oauth2/JOauth2ClientTest.php
Expand Up @@ -347,6 +347,7 @@ public function testRefreshTokenJson()
*/
function encodedGrantOauthCallback($url, $data, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'x-www-form-urlencoded');
Expand All @@ -370,6 +371,8 @@ function encodedGrantOauthCallback($url, $data, array $headers = null, $timeout
function jsonGrantOauthCallback($url, $data, array $headers = null, $timeout = null)
{

$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'application/json');
$response->body = '{"access_token":"accessvalue","refresh_token":"refreshvalue","expires_in":3600}';
Expand All @@ -391,6 +394,8 @@ function jsonGrantOauthCallback($url, $data, array $headers = null, $timeout = n
*/
function queryOauthCallback($url, $data, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'text/html');
$response->body = 'Lorem ipsum dolor sit amet.';
Expand All @@ -411,6 +416,8 @@ function queryOauthCallback($url, $data, array $headers = null, $timeout = null)
*/
function getOauthCallback($url, array $headers = null, $timeout = null)
{
$response = new stdClass;

$response->code = 200;
$response->headers = array('Content-Type' => 'text/html');
$response->body = 'Lorem ipsum dolor sit amet.';
Expand Down

0 comments on commit 5f6f62a

Please sign in to comment.