Example #1
0
 function it_throws_exception_when_keys_are_passed_that_are_not_iri_instances_during_instantiation()
 {
     $extensions = new \SplObjectStorage();
     $extensions->attach(IRL::fromString('http://id.tincanapi.com/extension/topic'), 'Conformance Testing');
     $this->beConstructedWith($extensions);
     $this->shouldThrow('\\InvalidArgumentException')->duringInstantiation();
 }
Example #2
0
 public function getModel()
 {
     $inverseFunctionalIdentifier = null;
     if (null !== $this->mbox) {
         $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withMbox(IRI::fromString($this->mbox));
     } elseif (null !== $this->mboxSha1Sum) {
         $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withMboxSha1Sum($this->mboxSha1Sum);
     } elseif (null !== $this->openId) {
         $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withOpenId($this->openId);
     } elseif (null !== $this->accountName && null !== $this->accountHomePage) {
         $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withAccount(new Account($this->accountName, IRL::fromString($this->accountHomePage)));
     }
     if ('group' === $this->type) {
         $members = array();
         foreach ($this->members as $agent) {
             $members[] = $agent->getModel();
         }
         return new Group($inverseFunctionalIdentifier, $this->name, $members);
     } else {
         return new Agent($inverseFunctionalIdentifier, $this->name);
     }
 }
Example #3
0
 function it_is_equal_to_other_definition_if_properties_are_equal()
 {
     $extensions = new \SplObjectStorage();
     $extensions->attach(IRI::fromString('http://id.tincanapi.com/extension/topic'), 'Conformance Testing');
     $this->beConstructedWith(LanguageMap::create(array('en-US' => 'test')), LanguageMap::create(array('en-US' => 'test')), IRI::fromString('http://id.tincanapi.com/activitytype/unit-test'), IRL::fromString('https://github.com/adlnet/xAPI_LRS_Test'), new Extensions($extensions));
     $extensions = new \SplObjectStorage();
     $extensions->attach(IRI::fromString('http://id.tincanapi.com/extension/topic'), 'Conformance Testing');
     $definition = $this->createEmptyDefinition();
     $definition = $definition->withName(LanguageMap::create(array('en-US' => 'test')));
     $definition = $definition->withDescription(LanguageMap::create(array('en-US' => 'test')));
     $definition = $definition->withType(IRI::fromString('http://id.tincanapi.com/activitytype/unit-test'));
     $definition = $definition->withMoreInfo(IRL::fromString('https://github.com/adlnet/xAPI_LRS_Test'));
     $definition = $definition->withExtensions(new Extensions($extensions));
     $this->equals($definition)->shouldReturn(true);
 }
 /**
  * Loads a statement result including a more reference.
  *
  * @return StatementResult
  */
 public static function getStatementResultWithMore()
 {
     $statementResult = static::getStatementResult(IRL::fromString('/xapi/statements/more/b381d8eca64a61a42c7b9b4ecc2fabb6'));
     return $statementResult;
 }
Example #5
0
 function it_ignores_array_keys_in_attachment_lists()
 {
     $textAttachment = new Attachment(IRI::fromString('http://id.tincanapi.com/attachment/supporting_media'), 'text/plain', 18, 'bd1a58265d96a3d1981710dab8b1e1ed04a8d7557ea53ab0cf7b44c04fd01545', LanguageMap::create(array('en-US' => 'Text attachment')), LanguageMap::create(array('en-US' => 'Text attachment description')), IRL::fromString('http://tincanapi.com/conformancetest/attachment/fileUrlOnly'));
     $attachments = array(1 => $textAttachment);
     $actor = new Agent(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest@tincanapi.com')));
     $verb = new Verb(IRI::fromString('http://tincanapi.com/conformancetest/verbid'), LanguageMap::create(array('en-US' => 'test')));
     $object = new Activity(IRI::fromString('http://tincanapi.com/conformancetest/activityid'));
     $this->beConstructedWith($actor, $verb, $object, null, null, null, $attachments);
     $this->getAttachments()->shouldBeArray();
     $this->getAttachments()->shouldHaveKeyWithValue(0, $textAttachment);
     $statement = $this->withAttachments($attachments);
     $statement->getAttachments()->shouldBeArray();
     $statement->getAttachments()->shouldHaveKeyWithValue(0, $textAttachment);
 }
 public static function getFileUrlOnlyAttachment()
 {
     return new Attachment(IRI::fromString('http://id.tincanapi.com/attachment/supporting_media'), 'application/octet-stream', 65556, 'd14f1580a2cebb6f8d4a8a2fc0d13c67f970e84f8d15677a93ae95c9080df899', LanguageMap::create(array('en-US' => 'FileUrl Only attachment')), null, IRL::fromString('http://tincanapi.com/conformancetest/attachment/fileUrlOnly'));
 }
 public static function getForQueryAccount()
 {
     return new Account('forQuery', IRL::fromString('https://tincanapi.com'));
 }
Example #8
0
 function it_is_not_equal_with_other_statement_if_attachments_differ()
 {
     $textAttachment = new Attachment(IRI::fromString('http://id.tincanapi.com/attachment/supporting_media'), 'text/plain', 18, 'bd1a58265d96a3d1981710dab8b1e1ed04a8d7557ea53ab0cf7b44c04fd01545', LanguageMap::create(array('en-US' => 'Text attachment')), LanguageMap::create(array('en-US' => 'Text attachment description')), IRL::fromString('http://tincanapi.com/conformancetest/attachment/fileUrlOnly'));
     $jsonAttachment = new Attachment(IRI::fromString('http://id.tincanapi.com/attachment/supporting_media'), 'application/json', 60, 'f4135c31e2710764604195dfe4e225884d8108467cc21670803e384b80df88ee', LanguageMap::create(array('en-US' => 'JSON attachment')), null, IRL::fromString('http://tincanapi.com/conformancetest/attachment/fileUrlOnly'));
     $statement = $this->withAttachments(array($textAttachment));
     $statement->equals($statement->withAttachments(array($jsonAttachment)))->shouldReturn(false);
 }
Example #9
0
 function it_is_equal_to_other_account_if_all_properties_are_equal()
 {
     $this->beConstructedWith('test', IRL::fromString('https://tincanapi.com'));
     $this->equals(new Account('test', IRL::fromString('https://tincanapi.com')))->shouldReturn(true);
 }
 public static function getAllPropertiesDefinition()
 {
     return new Definition(LanguageMap::create(array('en-US' => 'test')), LanguageMap::create(array('en-US' => 'test')), IRI::fromString('http://id.tincanapi.com/activitytype/unit-test'), IRL::fromString('https://github.com/adlnet/xAPI_LRS_Test'), ExtensionsFixtures::getTypicalExtensions());
 }
 public function testGetNextStatements()
 {
     $moreUrl = '/xapi/statements/more/b381d8eca64a61a42c7b9b4ecc2fabb6';
     $previousStatementResult = new StatementResult(array(), IRL::fromString($moreUrl));
     $this->validateRetrieveApiCall('get', $moreUrl, array(), 200, 'StatementResult', $previousStatementResult);
     $statementResult = $this->client->getNextStatements($previousStatementResult);
     $this->assertInstanceOf('\\Xabbuh\\XApi\\Model\\StatementResult', $statementResult);
 }
Example #12
0
 function it_is_equal_to_other_attachment_if_all_properties_are_equal()
 {
     $this->beConstructedWith(IRI::fromString('http://id.tincanapi.com/attachment/supporting_media'), 'text/plain', 18, 'bd1a58265d96a3d1981710dab8b1e1ed04a8d7557ea53ab0cf7b44c04fd01545', LanguageMap::create(array('en-US' => 'Text attachment')), LanguageMap::create(array('en-US' => 'Text attachment description')), IRL::fromString('http://tincanapi.com/conformancetest/attachment/fileUrlOnly'));
     $attachment = new Attachment(IRI::fromString('http://id.tincanapi.com/attachment/supporting_media'), 'text/plain', 18, 'bd1a58265d96a3d1981710dab8b1e1ed04a8d7557ea53ab0cf7b44c04fd01545', LanguageMap::create(array('en-US' => 'Text attachment')), LanguageMap::create(array('en-US' => 'Text attachment description')), IRL::fromString('http://tincanapi.com/conformancetest/attachment/fileUrlOnly'));
     $this->equals($attachment)->shouldReturn(true);
 }
 function its_account_value_can_be_retrieved_as_a_string()
 {
     $this->beConstructedWithAccount(new Account('test', IRL::fromString('https://tincanapi.com')));
     $this->__toString()->shouldReturn('test (https://tincanapi.com)');
 }