public function testUnwrapData()
 {
     $visitor = new JsonSerializationVisitor(new CamelCaseNamingStrategy());
     $type = array('name' => 'Xabbuh\\XApi\\Model\\Document', 'params' => array());
     $context = new SerializationContext();
     $this->handler->unwrapData($visitor, DocumentFixtures::getDocumentData(), $type, $context);
     $this->assertEquals(array('x' => 'foo', 'y' => 'bar'), $visitor->getRoot());
 }
 public function testGetDocument()
 {
     $document = DocumentFixtures::getAgentProfileDocument();
     $profile = $document->getAgentProfile();
     $this->validateRetrieveApiCall('get', 'agents/profile', array('agent' => 'agent-as-json', 'profileId' => 'profile-id'), 200, 'DocumentData', $document->getData(), array(array('data' => $profile->getAgent(), 'result' => 'agent-as-json')));
     $document = $this->client->getDocument($profile);
     $this->assertInstanceOf('Xabbuh\\XApi\\Model\\AgentProfileDocument', $document);
     $this->assertEquals($profile, $document->getAgentProfile());
 }
 public function testGetDocument()
 {
     $document = DocumentFixtures::getStateDocument();
     $state = $document->getState();
     $this->validateRetrieveApiCall('get', 'activities/state', array('activityId' => 'activity-id', 'agent' => 'agent-as-json', 'stateId' => 'state-id'), 200, 'DocumentData', $document->getData(), array(array('data' => $state->getActor(), 'result' => 'agent-as-json')));
     $document = $this->client->getDocument($state);
     $this->assertInstanceOf('Xabbuh\\XApi\\Model\\StateDocument', $document);
     $this->assertEquals($state, $document->getState());
 }
 public function testGetDocument()
 {
     $document = DocumentFixtures::getActivityProfileDocument();
     $activityProfile = $document->getActivityProfile();
     $this->validateRetrieveApiCall('get', 'activities/profile', array('activityId' => 'activity-id', 'profileId' => 'profile-id'), 200, 'DocumentData', $document->getData());
     $document = $this->client->getDocument($activityProfile);
     $this->assertInstanceOf('Xabbuh\\XApi\\Model\\ActivityProfileDocument', $document);
     $this->assertEquals($activityProfile, $document->getActivityProfile());
 }
 public function testSerializeStateDocument()
 {
     $document = DocumentFixtures::getStateDocument();
     $this->assertJsonEquals(DocumentJsonFixtures::getDocument(), $this->documentSerializer->serializeDocument($document));
 }
 public function testSerializeDocumentData()
 {
     $documentData = DocumentFixtures::getDocumentData();
     $this->assertJsonStringEqualsJsonString(DocumentJsonFixtures::getDocument(), $this->documentDataSerializer->serializeDocumentData($documentData));
 }