Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
leedavis81 committed Jul 16, 2013
1 parent caadeba commit 2c12072
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/DrestCommon/Representation/AbstractRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class AbstractRepresentation implements InterfaceRepresentation

/**
* Get the default error response object associated with this representation.
* @return ErrorResponse\ResponseInterface $response
* @return \DrestCommon\Error\Response\ResponseInterface $response
*/
public function getDefaultErrorResponse()
{
Expand Down
22 changes: 22 additions & 0 deletions tests/DrestCommonTests/Representation/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,26 @@ public function testJsonToArrayMatches()

$this->assertEquals($this->getJsonArray(), $representation->toArray());
}

public function testJsonRepCanBeUpdated()
{
$representation = Json::createFromString($this->getJsonString());

$obj = new \StdClass();
$obj->username = 'billybob';
$obj->email_address = 'billybob@somewhere.com';
$obj->phone_numbers = array('02045485658', '02096589654');
$representation->update($obj);

$exp = '{"stdclass":{"username":"billybob","email_address":"billybob@somewhere.com","phone_numbers":["02045485658","02096589654"]}}';

$this->assertEquals($exp, $representation->__toString());
}

public function testGetDefaultErrorResponseObject()
{
$representation = Json::createFromString($this->getJsonString());
$errorResp = $representation->getDefaultErrorResponse();
$this->assertInstanceOf('DrestCommon\Error\Response\ResponseInterface', $errorResp);
}
}
4 changes: 4 additions & 0 deletions tests/DrestCommonTests/ResultSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public function testResultSetSet()
$resultSet[] = 'part4';
$this->assertCount(4, $resultSet);
$this->assertTrue(($resultSet[3] == 'part4'));

$resultSet[1] = 'newpart2';
$this->assertCount(4, $resultSet);
$this->assertTrue(($resultSet[1] == 'newpart2'));
}

public function testResultSetOffsetExists()
Expand Down

0 comments on commit 2c12072

Please sign in to comment.