Example #1
0
 function it_can_filter_by_verb()
 {
     $this->byVerb(new Verb(IRI::fromString('http://tincanapi.com/conformancetest/verbid'), LanguageMap::create(array('en-US' => 'test'))))->shouldReturn($this);
     $filter = $this->getFilter();
     $filter->shouldHaveCount(1);
     $filter->shouldHaveKeyWithValue('verb', 'http://tincanapi.com/conformancetest/verbid');
 }
 /**
  * Loads a statement result.
  *
  * @param IRL $urlPath An optional URL path refering to more results
  *
  * @return StatementResult
  */
 public static function getStatementResult(IRL $urlPath = null)
 {
     $statement1 = StatementFixtures::getMinimalStatement();
     $verb = new Verb(IRI::fromString('http://adlnet.gov/expapi/verbs/deleted'), LanguageMap::create(array('en-US' => 'deleted')));
     $statement2 = new Statement(StatementId::fromString('12345678-1234-5678-8234-567812345679'), new Agent(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:bob@example.com'))), $verb, $statement1->getObject());
     $statementResult = new StatementResult(array($statement1, $statement2), $urlPath);
     return $statementResult;
 }
Example #3
0
 function its_properties_can_be_read()
 {
     $iri = IRI::fromString('http://tincanapi.com/conformancetest/verbid');
     $languageMap = LanguageMap::create(array('en-US' => 'test'));
     $this->beConstructedWith($iri, $languageMap);
     $this->getId()->shouldReturn($iri);
     $this->getDisplay()->shouldReturn($languageMap);
 }
Example #4
0
 public function getModel()
 {
     $display = null;
     if (null !== $this->display) {
         $display = LanguageMap::create($this->display);
     }
     return new VerbModel(IRI::fromString($this->id), $display);
 }
 public function getModel()
 {
     $description = null;
     if ($this->hasDescription) {
         $description = LanguageMap::create($this->description);
     }
     return new AttachmentModel(IRI::fromString($this->usageType), $this->contentType, $this->length, $this->sha2, LanguageMap::create($this->display), $description, $this->fileUrl);
 }
Example #6
0
 function it_is_equal_with_another_language_map_if_key_value_pairs_are_equal()
 {
     $languageMap = LanguageMap::create(array('en-GB' => 'attended', 'de-DE' => 'teilgenommen'));
     $this->equals($languageMap)->shouldReturn(true);
 }
Example #7
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);
 }
Example #8
0
 private function getActivityModel()
 {
     $definition = null;
     $type = null;
     $moreInfo = null;
     if ($this->hasActivityDefinition) {
         $name = null;
         $description = null;
         $extensions = null;
         if ($this->hasActivityName) {
             $name = LanguageMap::create($this->activityName);
         }
         if ($this->hasActivityDescription) {
             $description = LanguageMap::create($this->activityDescription);
         }
         if (null !== $this->activityType) {
             $type = IRI::fromString($this->activityType);
         }
         if (null !== $this->activityMoreInfo) {
             $moreInfo = IRL::fromString($this->activityMoreInfo);
         }
         if (null !== $this->activityExtensions) {
             $extensions = $this->activityExtensions->getModel();
         }
         $definition = new Definition($name, $description, $type, $moreInfo, $extensions);
     }
     return new Activity(IRI::fromString($this->activityId), $definition);
 }
 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'));
 }
Example #10
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 #11
0
 public static function getForQueryVerb()
 {
     return new Verb(IRI::fromString('http://tincanapi.com/conformancetest/verbid/forQuery'), LanguageMap::create(array('en-US' => 'for query')));
 }
 /**
  * Loads a statement including a sub statement.
  *
  * @param string $id The id of the new Statement
  *
  * @return Statement
  */
 public static function getStatementWithSubStatement($id = self::DEFAULT_STATEMENT_ID)
 {
     if (null === $id) {
         $id = UuidFixtures::getUniqueUuid();
     }
     $actor = new Agent(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:test@example.com')));
     $verb = new Verb(IRI::fromString('http://example.com/visited'), LanguageMap::create(array('en-US' => 'will visit')));
     $definition = new Definition(LanguageMap::create(array('en-US' => 'Some Awesome Website')), LanguageMap::create(array('en-US' => 'The visited website')), IRI::fromString('http://example.com/definition-type'));
     $activity = new Activity(IRI::fromString('http://example.com/website'), $definition);
     $subStatement = new SubStatement($actor, $verb, $activity);
     $actor = new Agent(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:test@example.com')));
     $verb = new Verb(IRI::fromString('http://example.com/planned'), LanguageMap::create(array('en-US' => 'planned')));
     return new Statement(StatementId::fromString($id), $actor, $verb, $subStatement);
 }
 public static function getForQueryDefinition()
 {
     return new Definition(LanguageMap::create(array('en-US' => 'for query')));
 }
Example #14
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);
 }
 public static function getAllPropertiesInteractionComponent()
 {
     return new InteractionComponent('test', LanguageMap::create(array('en-US' => 'test')));
 }
Example #16
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);
 }
 function it_is_equal_with_other_interaction_component_if_ids_and_descriptions_are_equal()
 {
     $this->beConstructedWith('test', LanguageMap::create(array('en-US' => 'test')));
     $interactionComponent = new InteractionComponent('test', LanguageMap::create(array('en-US' => 'test')));
     $this->equals($interactionComponent)->shouldReturn(true);
 }