Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

General code cleanup.

  • Loading branch information...
commit a4caf59de7435513e3fe47c87e2f1c5bc6566b31 1 parent 43da35d
@aaronschmitz aaronschmitz authored LouisLandry committed
View
2  libraries/joomla/google/auth/oauth2.php
@@ -28,7 +28,7 @@ class JGoogleAuthOauth2 extends JGoogleAuth
/**
* Constructor.
*
- * @param JRegistry $options JGoogleAuth options object.
+ * @param JRegistry $options JGoogleAuth options object.
* @param JOauthV2client $client OAuth client for Google authentication.
*
* @since 1234
View
8 libraries/joomla/google/data/calendar.php
@@ -245,7 +245,7 @@ public function deleteCalendar($calendarID)
$data = $this->auth->query('https://www.googleapis.com/calendar/v3/users/me/calendars/' . $calendarID, null, null, 'delete');
if ($data->body != '')
{
- throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
+ throw new UnexpectedValueException("Unexpected data received from Google: `{$data->body}`.");
}
return true;
}
@@ -338,10 +338,10 @@ public function deleteEvent($calendarID, $eventID)
if ($this->authenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendars/' . $calendarID . '/events/' . $eventID;
- $jdata = $this->auth->query($url, null, null, 'delete');
- if ($jdata != '')
+ $data = $this->auth->query($url, null, null, 'delete');
+ if ($data->body != '')
{
- throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
+ throw new UnexpectedValueException("Unexpected data received from Google: `{$data->body}`.");
}
return true;
}
View
2  libraries/joomla/google/data/picasa/photo.php
@@ -277,7 +277,7 @@ public function setSummary($summary)
public function setAccess($access)
{
$this->xml->children('gphoto', true)->access = $access;
- return $this;
+ return $this;
}
/**
View
8 tests/suites/unit/joomla/google/JGoogleAuthOauth2Test.php
@@ -93,7 +93,7 @@ public function testAuth()
$this->assertEquals($this->oauth->createUrl(), $header['value']);
}
}
- $this->assertEquals(true, $location);
+ $this->assertTrue($location);
$this->object->setOption('clientsecret', 'jeDs8rKw_jDJW8MMf-ff8ejs');
$this->input->set('code', '4/wEr_dK8SDkjfpwmc98KejfiwJP-f4wm.kdowmnr82jvmeisjw94mKFIJE48mcEM');
@@ -113,7 +113,7 @@ public function testAuth()
*/
public function testIsAuth()
{
- $this->assertEquals(false, $this->object->isAuth());
+ $this->assertFalse($this->object->isAuth());
$token['access_token'] = 'accessvalue';
$token['refresh_token'] = 'refreshvalue';
@@ -121,13 +121,13 @@ public function testIsAuth()
$token['expires_in'] = 3600;
$this->oauth->setToken($token);
- $this->assertEquals(true, $this->object->isAuth());
+ $this->assertTrue($this->object->isAuth());
$token['created'] = time() - 4000;
$token['expires_in'] = 3600;
$this->oauth->setToken($token);
- $this->assertEquals(false, $this->object->isAuth());
+ $this->assertFalse($this->object->isAuth());
}
/**
View
10 tests/suites/unit/joomla/google/JGoogleDataCalendarTest.php
@@ -117,7 +117,7 @@ public function testRemoveCalendar()
{
$this->http->expects($this->once())->method('delete')->will($this->returnCallback('emptyCalendarCallback'));
$result = $this->object->removeCalendar('calendarID');
- $this->assertEquals($result, true);
+ $this->assertTrue($result);
}
/**
@@ -182,7 +182,7 @@ public function testClearCalendar()
{
$this->http->expects($this->once())->method('post')->will($this->returnCallback('emptyDataCalendarCallback'));
$result = $this->object->clearCalendar('calendarID');
- $this->assertEquals($result, true);
+ $this->assertTrue($result);
}
/**
@@ -195,7 +195,7 @@ public function testDeleteCalendar()
{
$this->http->expects($this->once())->method('delete')->will($this->returnCallback('emptyCalendarCallback'));
$result = $this->object->deleteCalendar('calendarID');
- $this->assertEquals($result, true);
+ $this->assertTrue($result);
}
/**
@@ -233,8 +233,8 @@ public function testEditCalendar()
public function testDeleteEvent()
{
$this->http->expects($this->once())->method('delete')->will($this->returnCallback('emptyCalendarCallback'));
- $result = $this->object->deleteCalendar('calendarID', 'eventID');
- $this->assertEquals($result, true);
+ $result = $this->object->deleteEvent('calendarID', 'eventID');
+ $this->assertTrue($result);
}
/**
View
44 tests/suites/unit/joomla/google/JGoogleDataPicasaAlbumTest.php
@@ -66,7 +66,7 @@ protected function setUp()
$this->input = new JInput;
$this->oauth = new JOauthV2client($this->options, $this->http, $this->input);
$this->auth = new JGoogleAuthOauth2($this->options, $this->oauth);
- $this->xml = new SimpleXMLElement(JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'album.txt'));
+ $this->xml = new SimpleXMLElement(JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'album.txt'));
$this->object = new JGoogleDataPicasaAlbum($this->xml, $this->options, $this->auth);
$this->object->setOption('clientid', '01234567891011.apps.googleusercontent.com');
@@ -122,8 +122,8 @@ public function testIsAuth()
public function testDelete()
{
$this->http->expects($this->once())->method('delete')->will($this->returnCallback('emptyPicasaCallback'));
- $results = $this->object->delete();
- $this->assertEquals($results, true);
+ $result = $this->object->delete();
+ $this->assertTrue($result);
}
/**
@@ -268,10 +268,10 @@ public function testSetTime()
*/
public function testSave()
{
- $this->http->expects($this->exactly(2))->method('put')->will($this->returnCallback('XMLDataPicasaAlbumCallback'));
+ $this->http->expects($this->exactly(2))->method('put')->will($this->returnCallback('dataPicasaAlbumCallback'));
$this->object->setTitle('New Title');
- $this->object->save();
- $this->object->save(true);
+ $this->object->save();
+ $this->object->save(true);
}
/**
@@ -282,7 +282,7 @@ public function testSave()
*/
public function testRefresh()
{
- $this->http->expects($this->once())->method('get')->will($this->returnCallback('XMLPicasaAlbumCallback'));
+ $this->http->expects($this->once())->method('get')->will($this->returnCallback('picasaAlbumCallback'));
$result = $this->object->refresh();
$this->assertEquals(get_class($result), 'JGoogleDataPicasaAlbum');
}
@@ -295,17 +295,17 @@ public function testRefresh()
*/
public function testListPhotos()
{
- $this->http->expects($this->once())->method('get')->will($this->returnCallback('XMLPicasaPhotolistCallback'));
+ $this->http->expects($this->once())->method('get')->will($this->returnCallback('picasaPhotolistCallback'));
$results = $this->object->listPhotos();
$this->assertEquals(count($results), 2);
- $i = 1;
- foreach ($results as $result)
- {
- $this->assertEquals(get_class($result), 'JGoogleDataPicasaPhoto');
- $this->assertEquals($result->getTitle(), 'Photo' . $i . '.jpg');
- $i++;
- }
+ $i = 1;
+ foreach ($results as $result)
+ {
+ $this->assertEquals(get_class($result), 'JGoogleDataPicasaPhoto');
+ $this->assertEquals($result->getTitle(), 'Photo' . $i . '.jpg');
+ $i++;
+ }
}
/**
@@ -316,10 +316,10 @@ public function testListPhotos()
*/
public function testUpload()
{
- $this->http->expects($this->once())->method('post')->will($this->returnCallback('XMLDataPicasaUploadCallback'));
+ $this->http->expects($this->once())->method('post')->will($this->returnCallback('dataPicasaUploadCallback'));
$result = $this->object->upload(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'logo.png');
- $this->assertEquals(get_class($result), 'JGoogleDataPicasaPhoto');
+ $this->assertEquals(get_class($result), 'JGoogleDataPicasaPhoto');
}
}
@@ -354,9 +354,9 @@ function emptyPicasaCallback($url, array $headers = null, $timeout = null)
*
* @since 12.2
*/
-function XMLPicasaPhotolistCallback($url, array $headers = null, $timeout = null)
+function picasaPhotolistCallback($url, array $headers = null, $timeout = null)
{
- $response->code = 200;
+ $response->code = 200;
$response->headers = array('Content-Type' => 'text/html');
$response->body = JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'photolist.txt');
@@ -375,11 +375,11 @@ function XMLPicasaPhotolistCallback($url, array $headers = null, $timeout = null
*
* @since 12.2
*/
-function XMLDataPicasaUploadCallback($url, $data, array $headers = null, $timeout = null)
+function dataPicasaUploadCallback($url, $data, array $headers = null, $timeout = null)
{
- $response->code = 200;
+ $response->code = 200;
$response->headers = array('Content-Type' => 'text/html');
$response->body = JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'photo.txt');
return $response;
-}
+}
View
37 tests/suites/unit/joomla/google/JGoogleDataPicasaPhotoTest.php
@@ -66,7 +66,7 @@ protected function setUp()
$this->input = new JInput;
$this->oauth = new JOauthV2client($this->options, $this->http, $this->input);
$this->auth = new JGoogleAuthOauth2($this->options, $this->oauth);
- $this->xml = new SimpleXMLElement(JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'photo.txt'));
+ $this->xml = new SimpleXMLElement(JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'photo.txt'));
$this->object = new JGoogleDataPicasaPhoto($this->xml, $this->options, $this->auth);
$this->object->setOption('clientid', '01234567891011.apps.googleusercontent.com');
@@ -122,8 +122,8 @@ public function testIsAuth()
public function testDelete()
{
$this->http->expects($this->once())->method('delete')->will($this->returnCallback('emptyPicasaCallback'));
- $results = $this->object->delete();
- $this->assertEquals($results, true);
+ $result = $this->object->delete();
+ $this->assertTrue($result);
}
/**
@@ -134,10 +134,11 @@ public function testDelete()
*/
public function testGetLink()
{
+ $url = 'https://picasaweb.google.com/data/entry/api/user/12345678901234567890/albumid/0123456789012345678/photoid/12345678901234567890';
$link = $this->object->getLink();
- $this->assertEquals($link, 'https://picasaweb.google.com/data/entry/api/user/12345678901234567890/albumid/0123456789012345678/photoid/12345678901234567890');
+ $this->assertEquals($link, $url);
$link = $this->object->getLink('self');
- $this->assertEquals($link, 'https://picasaweb.google.com/data/entry/api/user/12345678901234567890/albumid/0123456789012345678/photoid/12345678901234567890');
+ $this->assertEquals($link, $url);
}
/**
@@ -161,9 +162,9 @@ public function testGetURL()
public function testGetThumbnails()
{
$thumbs = $this->object->getThumbnails();
- $valid[72] = array('url' => 'https://lh3.googleusercontent.com/sdgfdfgsdgf/werewr/aswertrt/vdfderer/s72/Photo2.jpg', 'w' => 72, 'h' => 54);
- $valid[144] = array('url' => 'https://lh3.googleusercontent.com/sdgfdfgsdgf/werewr/aswertrt/vdfderer/s144/Photo2.jpg', 'w' => 144, 'h' => 108);
- $valid[288] = array('url' => 'https://lh3.googleusercontent.com/sdgfdfgsdgf/werewr/aswertrt/vdfderer/s288/Photo2.jpg', 'w' => 288, 'h' => 216);
+ $valid[72] = array('url' => 'https://lh3.googleusercontent.com/sdgfdfgsdgf/werewr/aswertrt/vdfderer/s72/Photo2.jpg', 'w' => 72, 'h' => 54);
+ $valid[144] = array('url' => 'https://lh3.googleusercontent.com/sdgfdfgsdgf/werewr/aswertrt/vdfderer/s144/Photo2.jpg', 'w' => 144, 'h' => 108);
+ $valid[288] = array('url' => 'https://lh3.googleusercontent.com/sdgfdfgsdgf/werewr/aswertrt/vdfderer/s288/Photo2.jpg', 'w' => 288, 'h' => 216);
$this->assertEquals($thumbs, $valid);
}
@@ -307,10 +308,10 @@ public function testSetTime()
*/
public function testSave()
{
- $this->http->expects($this->exactly(2))->method('put')->will($this->returnCallback('XMLDataPicasaPhotoCallback'));
+ $this->http->expects($this->exactly(2))->method('put')->will($this->returnCallback('dataPicasaPhotoCallback'));
$this->object->setTitle('New Title');
- $this->object->save();
- $this->object->save(true);
+ $this->object->save();
+ $this->object->save(true);
}
/**
@@ -321,9 +322,9 @@ public function testSave()
*/
public function testRefresh()
{
- $this->http->expects($this->once())->method('get')->will($this->returnCallback('XMLPicasaPhotoCallback'));
+ $this->http->expects($this->once())->method('get')->will($this->returnCallback('picasaPhotoCallback'));
$result = $this->object->refresh();
- $this->assertEquals(get_class($result), 'JGoogleDataPicasaPhoto');
+ $this->assertEquals(get_class($result), 'JGoogleDataPicasaPhoto');
}
}
@@ -338,9 +339,9 @@ public function testRefresh()
*
* @since 12.2
*/
-function XMLPicasaPhotoCallback($url, array $headers = null, $timeout = null)
+function picasaPhotoCallback($url, array $headers = null, $timeout = null)
{
- $response->code = 200;
+ $response->code = 200;
$response->headers = array('Content-Type' => 'text/html');
$response->body = JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'photo.txt');
@@ -359,11 +360,11 @@ function XMLPicasaPhotoCallback($url, array $headers = null, $timeout = null)
*
* @since 12.2
*/
-function XMLDataPicasaPhotoCallback($url, $data, array $headers = null, $timeout = null)
+function dataPicasaPhotoCallback($url, $data, array $headers = null, $timeout = null)
{
- PHPUnit_Framework_TestCase::assertContains('<title>New Title</title>', $data);
+ PHPUnit_Framework_TestCase::assertContains('<title>New Title</title>', $data);
- $response->code = 200;
+ $response->code = 200;
$response->headers = array('Content-Type' => 'text/html');
$response->body = $data;
View
46 tests/suites/unit/joomla/google/JGoogleDataPicasaTest.php
@@ -115,17 +115,17 @@ public function testIsAuth()
*/
public function testListAlbums()
{
- $this->http->expects($this->once())->method('get')->will($this->returnCallback('XMLPicasaAlbumlistCallback'));
+ $this->http->expects($this->once())->method('get')->will($this->returnCallback('picasaAlbumlistCallback'));
$results = $this->object->listAlbums('userID');
$this->assertEquals(count($results), 2);
- $i = 1;
- foreach ($results as $result)
- {
- $this->assertEquals(get_class($result), 'JGoogleDataPicasaAlbum');
- $this->assertEquals($result->getTitle(), 'Album ' .$i);
- $i++;
- }
+ $i = 1;
+ foreach ($results as $result)
+ {
+ $this->assertEquals(get_class($result), 'JGoogleDataPicasaAlbum');
+ $this->assertEquals($result->getTitle(), 'Album ' . $i);
+ $i++;
+ }
}
/**
@@ -136,10 +136,10 @@ public function testListAlbums()
*/
public function testCreateAlbum()
{
- $this->http->expects($this->once())->method('post')->will($this->returnCallback('XMLDataPicasaAlbumCallback'));
+ $this->http->expects($this->once())->method('post')->will($this->returnCallback('dataPicasaAlbumCallback'));
$result = $this->object->createAlbum('userID', 'New Title', 'private');
- $this->assertEquals(get_class($result), 'JGoogleDataPicasaAlbum');
- $this->assertEquals($result->getTitle(), 'New Title');
+ $this->assertEquals(get_class($result), 'JGoogleDataPicasaAlbum');
+ $this->assertEquals($result->getTitle(), 'New Title');
}
/**
@@ -150,10 +150,10 @@ public function testCreateAlbum()
*/
public function testGetAlbum()
{
- $this->http->expects($this->once())->method('get')->will($this->returnCallback('XMLPicasaAlbumCallback'));
+ $this->http->expects($this->once())->method('get')->will($this->returnCallback('picasaAlbumCallback'));
$result = $this->object->getAlbum('https://picasaweb.google.com/data/entry/api/user/12345678901234567890/albumid/0123456789012345678');
- $this->assertEquals(get_class($result), 'JGoogleDataPicasaAlbum');
- $this->assertEquals($result->getTitle(), 'Album 2');
+ $this->assertEquals(get_class($result), 'JGoogleDataPicasaAlbum');
+ $this->assertEquals($result->getTitle(), 'Album 2');
}
}
@@ -168,9 +168,9 @@ public function testGetAlbum()
*
* @since 12.2
*/
-function XMLPicasaAlbumCallback($url, array $headers = null, $timeout = null)
+function picasaAlbumCallback($url, array $headers = null, $timeout = null)
{
- $response->code = 200;
+ $response->code = 200;
$response->headers = array('Content-Type' => 'text/html');
$response->body = JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'album.txt');
@@ -189,11 +189,11 @@ function XMLPicasaAlbumCallback($url, array $headers = null, $timeout = null)
*
* @since 12.2
*/
-function XMLDataPicasaAlbumCallback($url, $data, array $headers = null, $timeout = null)
+function dataPicasaAlbumCallback($url, $data, array $headers = null, $timeout = null)
{
- PHPUnit_Framework_TestCase::assertContains('<title>New Title</title>', $data);
+ PHPUnit_Framework_TestCase::assertContains('<title>New Title</title>', $data);
- $response->code = 200;
+ $response->code = 200;
$response->headers = array('Content-Type' => 'text/html');
$response->body = $data;
@@ -211,11 +211,11 @@ function XMLDataPicasaAlbumCallback($url, $data, array $headers = null, $timeout
*
* @since 12.2
*/
-function XMLPicasaAlbumlistCallback($url, array $headers = null, $timeout = null)
+function picasaAlbumlistCallback($url, array $headers = null, $timeout = null)
{
- $response->code = 200;
+ $response->code = 200;
$response->headers = array('Content-Type' => 'text/html');
- $response->body = JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'albumlist.txt');
+ $response->body = JFile::read(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'albumlist.txt');
return $response;
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.