Skip to content

Commit

Permalink
ClientResult Value is readonly property now, minor changes for unit t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
vgrem committed Aug 3, 2018
1 parent 53e8586 commit 35710e4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 34 deletions.
24 changes: 16 additions & 8 deletions src/Runtime/ClientResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ class ClientResult

function __construct($returnValue=null)
{
$this->Value = $returnValue;
$this->value = $returnValue;
}

/**
* @return null|string
*/
public function getType(){
if(!is_null($this->Value))
if(!is_null($this->value))
{
if($this->Value instanceof IEntityType)
return $this->Value->getTypeName();
return basename(get_class($this->Value));
if($this->value instanceof IEntityType)
return $this->value->getTypeName();
return basename(get_class($this->value));
}
return null;
}
Expand All @@ -36,12 +36,20 @@ public function getType(){
*/
public function fromJson($json, ODataSerializerContext $serializationContext)
{
$serializationContext->map($json, $this->Value);
$serializationContext->map($json, $this->value);
}


public function getValue(){
return $this->value;
}

/**
* @var mixed $Value
* @var mixed $value
*/
public $Value;
protected $value;




}
18 changes: 0 additions & 18 deletions src/Runtime/OData/ODataRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,22 +243,4 @@ protected function getCurrentAction(){
return current($this->getActions());
}



/**
* @param string $key
* @return bool
*/
protected function isMetadataProperty($key)
{
return ($key === JsonLightSerializerContext::MetadataTag);
}

protected function isDeferredProperty($value)
{
if (isset($value->__deferred))
return true;
return false;
}

}
10 changes: 5 additions & 5 deletions tests/PeopleManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testGetUserProfilePropertyFor(){
$peopleManager = new PeopleManager(self::$context);
$result = $peopleManager->getUserProfilePropertyFor(self::$accountName,"AccountName");
self::$context->executeQuery();
$this->assertNotNull($result->Value);
$this->assertNotNull($result->getValue());
}


Expand All @@ -32,7 +32,7 @@ public function testFollow(){
$result = $peopleManager->amIFollowing(self::$accountName);
self::$context->executeQuery();

if($result->Value == false){
if($result->getValue() == false){
$peopleManager->follow(self::$accountName);
self::$context->executeQuery();
}
Expand All @@ -50,23 +50,23 @@ public function testStopFollowing(){
$result = $peopleManager->amIFollowing(self::$accountName);
self::$context->executeQuery();

if($result->Value == true){
if($result->getValue() == true){
$peopleManager->stopFollowing(self::$accountName);
self::$context->executeQuery();
}


$result = $peopleManager->amIFollowing(self::$accountName);
self::$context->executeQuery();
self::assertFalse($result->Value);
self::assertFalse($result->getValue());
}


public function testAmIFollowedBy(){
$peopleManager = new PeopleManager(self::$context);
$result = $peopleManager->amIFollowedBy(self::$accountName);
self::$context->executeQuery();
self::assertNotNull($result->Value);
self::assertNotNull($result->getValue());
}


Expand Down
3 changes: 1 addition & 2 deletions tests/VideoServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ public function testDeleteVideo(VideoItem $videoItem)
function (VideoItem $item) use ($videoId) {
return $item->getProperty("ID") === $videoId;
});

self::assertEquals(0,count($result));
self::assertNull($result);
}


Expand Down
2 changes: 1 addition & 1 deletion tests/WebTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function testGetWebProperties()
{
$result = self::$context->getWeb()->getSupportedUILanguageIds();
self::$context->executeQuery();
self::assertNotEmpty($result->Value);
self::assertNotEmpty($result->getValue());
}


Expand Down

0 comments on commit 35710e4

Please sign in to comment.