Author: chabotc
Date: Sun Aug 24 02:32:41 2008
New Revision: 688480
URL: http://svn.apache.org/viewvc?rev=688480&view=rev
Log:
Fix up test cases for new LookingFor enum
Modified:
incubator/shindig/trunk/php/src/social-api/opensocial/model/Enum.php
incubator/shindig/trunk/php/test/social-api/PeopleHandlerTest.php
incubator/shindig/trunk/php/test/social-api/PersonTest.php
Modified: incubator/shindig/trunk/php/src/social-api/opensocial/model/Enum.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social-api/opensocial/model/Enum.php?rev=688480&r1=688479&r2=688480&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social-api/opensocial/model/Enum.php
(original)
+++ incubator/shindig/trunk/php/src/social-api/opensocial/model/Enum.php Sun
Aug 24 02:32:41 2008
@@ -33,7 +33,6 @@
public function __construct($key, $displayValue = '')
{
- //FIXME should add enum restriction checking to this
if (! empty($key) && ! isset($this->values[$key])) {
if (in_array($key, $this->values)) {
// case of mixing key <> display value, correct
it
@@ -41,6 +40,7 @@
} else {
throw new Exception("Invalid Enum key");
}
+ throw new Exception("Invalid Enum key");
}
$this->key = $key;
$this->displayValue = ! empty($displayValue) ? $displayValue :
$this->values[$key];
Modified: incubator/shindig/trunk/php/test/social-api/PeopleHandlerTest.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/social-api/PeopleHandlerTest.php?rev=688480&r1=688479&r2=688480&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/social-api/PeopleHandlerTest.php (original)
+++ incubator/shindig/trunk/php/test/social-api/PeopleHandlerTest.php Sun Aug
24 02:32:41 2008
@@ -69,8 +69,6 @@
$response = $this->PeopleHandler->handleGet($requestItem);
$person = $response->getResponse();
$this->assertEquals('john.doe', $person['id']);
- $this->assertEquals('MALE', $person['gender']['key']);
- $this->assertEquals('Male', $person['gender']['displayValue']);
$this->assertEquals('Doe', $person['name']['familyName']);
$this->assertEquals('John', $person['name']['givenName']);
$this->assertEquals('John Doe',
$person['name']['unstructured']);
Modified: incubator/shindig/trunk/php/test/social-api/PersonTest.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/social-api/PersonTest.php?rev=688480&r1=688479&r2=688480&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/social-api/PersonTest.php (original)
+++ incubator/shindig/trunk/php/test/social-api/PersonTest.php Sun Aug 24
02:32:41 2008
@@ -59,7 +59,7 @@
$this->Person->jobs = 'JOBS';
$this->Person->languagesSpoken = 'LANGUAGESSPOKEN';
$this->Person->livingArrangement = 'LIVINGARRANGEMENT';
- $this->Person->lookingFor = 'LOOKINGFOR';
+ $this->Person->lookingFor = new EnumLookingFor('FRIENDS');
$this->Person->movies = 'MOVIES';
$this->Person->music = 'MUSIC';
$this->Person->networkPresence = 'NETWORKPRESENCE';
@@ -337,7 +337,7 @@
*/
public function testGetLookingFor()
{
- $this->assertEquals('LOOKINGFOR',
$this->Person->getLookingFor());
+ $this->assertEquals(new EnumLookingFor('FRIENDS'),
$this->Person->getLookingFor());
}
/**
@@ -826,8 +826,8 @@
*/
public function testSetLookingFor()
{
- $this->Person->setLookingFor('lookingfor');
- $this->assertEquals('lookingfor', $this->Person->lookingFor);
+ $this->Person->setLookingFor('FRIENDS');
+ $this->assertEquals(new EnumLookingFor('FRIENDS'),
$this->Person->getLookingFor());
}
/**