Actualización

This commit is contained in:
Xes
2025-04-10 12:24:57 +02:00
parent 8969cc929d
commit 45420b6f0d
39760 changed files with 4303286 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
/composer.lock
/vendor

View File

@@ -0,0 +1,35 @@
sudo: false
language: php
cache:
directories:
- $HOME/.composer/cache/files
php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm
matrix:
fast_finish: true
include:
- php: 5.3
dist: precise
env: COMPOSER_FLAGS="--prefer-lowest"
- php: 7.2
env: deps="high"
before_install:
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi
- composer self-update
install:
- if [ "$deps" = "high" ]; then composer config minimum-stability dev; fi
- composer update $COMPOSER_FLAGS
script:
- php validate.php

View File

@@ -0,0 +1,84 @@
CHANGELOG
=========
1.1.0
-----
* made the package compatible with `3.x` releases of `ramsey/uuid`
* allow `2.x` releases of the `php-xapi/model` package too
* allow `3.x` releases of the `php-xapi/model` package too
1.0.1
-----
Raw content data has been added to the "text attachment" and "JSON attachment"
fixtures.
1.0.0
-----
This first stable release contains all the official conformance test fixtures
provided by the maintainers of the xAPI spec as instances of the class offered
by the `php-xapi/model` package and provides ways to access them through
a PHP API.
This release is equivalent to the 0.5 release series (except for the version
of the required `php-xapi/model` package being 1.x now) and is considered
to be stable.
0.5.0
-----
* Updated fixtures to use `IRI` and `IRL` instances where they have been
introduced in the `php-xapi/model` package.
* Added a `Statement` fixture defining all properties of a statement.
* Added fixtures for statement attachments.
* Added fixtures for activity definition extensions.
* Added fixtures for activity interaction definitions and interaction components.
* Updated fixtures for `Definition`, `Statement`, `StatementResult`, and
`Verb` to use `LanguageMap` instances instead of plain old PHP arrays.
* Updated fixtures for `Statement`, `StatementReference`, and `StatementResult`
to use `StatementId` objects instead of string ids.
* Added missing fixtures for `Account`, `Activity`, `Actor`, `Context`,
`ContextActivities`, `Extensions`, `Result`, and `Verb`.
0.4.0
-----
* Added missing `timestamp` value to the typical statement.
* when `null` is passed as the id argument to one of the methods of the
`StatementFixtures` class, a unique UUID will be generated
0.3.0
-----
Switched to make use of the official conformance test fixtures that are provided
by the maintainers of the xAPI spec.
0.2.0
-----
* compatibility with release 0.2 of the `php-xapi/model` package
0.1.1
-----
* restrict dependency version to not pull in potentially BC breaking package
versions
0.1.0
-----
This is the first release containing test fixtures for actors (agents and
groups), verbs, documents, activities,statements, and statement results.
This package replaces the `xabbuh/xapi-data-fixtures` package which is now
deprecated and should no longer be used.

19
vendor/php-xapi/test-fixtures/LICENSE vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2014-2018 Christian Flothmann
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,4 @@
Experience API Test Fixtures
============================
Package providing test data fixtures for the xAPI packages.

View File

@@ -0,0 +1,32 @@
{
"name": "php-xapi/test-fixtures",
"type": "library",
"description": "common test data fixtures for Experience API related packages",
"keywords": ["xAPI", "Experience API", "Tin Can API", "fixtures", "data fixtures", "test fixtures"],
"homepage": "https://github.com/php-xapi/test-fixtures",
"license": "MIT",
"authors": [
{
"name": "Christian Flothmann",
"homepage": "https://github.com/xabbuh"
}
],
"require": {
"php": ">=5.3.0",
"php-xapi/model": "^1.1 || ^2.0 || ^3.0",
"ramsey/uuid": "^2.9 || ^3.0"
},
"conflict": {
"xabbuh/xapi-data-fixtures": "*"
},
"autoload": {
"psr-4": {
"Xabbuh\\XApi\\DataFixtures\\": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
}
}

View File

@@ -0,0 +1,44 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\Account;
use Xabbuh\XApi\Model\IRL;
/**
* xAPI account fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class AccountFixtures
{
public static function getTypicalAccount()
{
return new Account('test', IRL::fromString('https://tincanapi.com'));
}
public static function getConsumerAccount()
{
return new Account('oauth_consumer_x75db', IRL::fromString('https://tincanapi.com/OAuth/Token'));
}
public static function getAllPropertiesAccount()
{
return new Account('test', IRL::fromString('https://tincanapi.com'));
}
public static function getForQueryAccount()
{
return new Account('forQuery', IRL::fromString('https://tincanapi.com'));
}
}

View File

@@ -0,0 +1,49 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\Activity;
use Xabbuh\XApi\Model\IRI;
/**
* xAPI statement activity fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class ActivityFixtures
{
public static function getTypicalActivity()
{
return new Activity(IRI::fromString('http://tincanapi.com/conformancetest/activityid'));
}
public static function getIdActivity()
{
return new Activity(IRI::fromString('http://tincanapi.com/conformancetest/activityid'));
}
public static function getIdAndDefinitionActivity()
{
return new Activity(IRI::fromString('http://tincanapi.com/conformancetest/activityid'), DefinitionFixtures::getTypicalDefinition());
}
public static function getAllPropertiesActivity()
{
return new Activity(IRI::fromString('http://tincanapi.com/conformancetest/activityid'), DefinitionFixtures::getTypicalDefinition());
}
public static function getForQueryActivity()
{
return new Activity(IRI::fromString('http://tincanapi.com/conformancetest/activityid/forQuery'), DefinitionFixtures::getForQueryDefinition());
}
}

View File

@@ -0,0 +1,167 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\Account;
use Xabbuh\XApi\Model\Agent;
use Xabbuh\XApi\Model\Group;
use Xabbuh\XApi\Model\InverseFunctionalIdentifier;
use Xabbuh\XApi\Model\IRI;
/**
* xAPI actor fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class ActorFixtures
{
public static function getTypicalAgent()
{
return new Agent(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest@tincanapi.com')));
}
public static function getMboxAgent()
{
return new Agent(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest@tincanapi.com')));
}
public static function getMboxSha1SumAgent()
{
return new Agent(InverseFunctionalIdentifier::withMboxSha1Sum('db77b9104b531ecbb0b967f6942549d0ba80fda1'));
}
public static function getOpenIdAgent()
{
return new Agent(InverseFunctionalIdentifier::withOpenId('http://openid.tincanapi.com'));
}
public static function getAccountAgent()
{
return new Agent(InverseFunctionalIdentifier::withAccount(AccountFixtures::getTypicalAccount()));
}
public static function getForQueryMboxAgent()
{
return new Agent(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest+query@tincanapi.com')));
}
public static function getForQueryMboxSha1SumAgent()
{
return new Agent(InverseFunctionalIdentifier::withMboxSha1Sum('6954e807cfbfc5b375d185de32f05de269f93d6f'));
}
public static function getForQueryOpenIdAgent()
{
return new Agent(InverseFunctionalIdentifier::withOpenId('http://openid.tincanapi.com/query'));
}
public static function getForQueryAccountAgent()
{
return new Agent(InverseFunctionalIdentifier::withAccount(AccountFixtures::getForQueryAccount()));
}
public static function getTypicalGroup()
{
return new Group(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest-group@tincanapi.com')));
}
public static function getMboxGroup()
{
return new Group(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest-group@tincanapi.com')));
}
public static function getMboxSha1SumGroup()
{
return new Group(InverseFunctionalIdentifier::withMboxSha1Sum('4e271041e78101311fb37284ef1a1d35c3f1db35'));
}
public static function getOpenIdGroup()
{
return new Group(InverseFunctionalIdentifier::withOpenId('http://group.openid.tincanapi.com'));
}
public static function getAccountGroup()
{
return new Group(InverseFunctionalIdentifier::withAccount(AccountFixtures::getTypicalAccount()));
}
public static function getMboxAndNameGroup()
{
return new Group(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest-group@tincanapi.com')), 'test group');
}
public static function getMboxSha1SumAndNameGroup()
{
return new Group(InverseFunctionalIdentifier::withMboxSha1Sum('4e271041e78101311fb37284ef1a1d35c3f1db35'), 'test group');
}
public static function getOpenIdAndNameGroup()
{
return new Group(InverseFunctionalIdentifier::withOpenId('http://group.openid.tincanapi.com'), 'test group');
}
public static function getAccountAndNameGroup()
{
return new Group(InverseFunctionalIdentifier::withAccount(AccountFixtures::getTypicalAccount()), 'test group');
}
public static function getMboxAndMemberGroup()
{
return new Group(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest-group@tincanapi.com')), null, array(self::getTypicalAgent()));
}
public static function getMboxSha1SumAndMemberGroup()
{
return new Group(InverseFunctionalIdentifier::withMboxSha1Sum('4e271041e78101311fb37284ef1a1d35c3f1db35'), null, array(self::getTypicalAgent()));
}
public static function getOpenIdAndMemberGroup()
{
return new Group(InverseFunctionalIdentifier::withOpenId('http://group.openid.tincanapi.com'), null, array(self::getTypicalAgent()));
}
public static function getAccountAndMemberGroup()
{
return new Group(InverseFunctionalIdentifier::withAccount(AccountFixtures::getTypicalAccount()), null, array(self::getTypicalAgent()));
}
public static function getAllPropertiesAndTypicalAgentMemberGroup()
{
return new Group(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest-group@tincanapi.com')), 'test group', array(self::getTypicalAgent()));
}
public static function getAllPropertiesAndMboxAgentMemberGroup()
{
return new Group(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest-group@tincanapi.com')), 'test group', array(self::getMboxAgent()));
}
public static function getAllPropertiesAndMboxSha1SumAgentMemberGroup()
{
return new Group(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest-group@tincanapi.com')), 'test group', array(self::getMboxSha1SumAgent()));
}
public static function getAllPropertiesAndOpenIdAgentMemberGroup()
{
return new Group(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest-group@tincanapi.com')), 'test group', array(self::getOpenIdAgent()));
}
public static function getAllPropertiesAndAccountAgentMemberGroup()
{
return new Group(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest-group@tincanapi.com')), 'test group', array(self::getAccountAgent()));
}
public static function getAllPropertiesAndTwoTypicalAgentMembersGroup()
{
return new Group(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest-group@tincanapi.com')), 'test group', array(self::getTypicalAgent(), self::getTypicalAgent()));
}
}

View File

@@ -0,0 +1,67 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\Attachment;
use Xabbuh\XApi\Model\IRI;
use Xabbuh\XApi\Model\IRL;
use Xabbuh\XApi\Model\LanguageMap;
/**
* xAPI statement attachment fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class AttachmentFixtures
{
public static function getTextAttachment()
{
return new Attachment(
IRI::fromString('http://id.tincanapi.com/attachment/supporting_media'),
'text/plain',
18,
'bd1a58265d96a3d1981710dab8b1e1ed04a8d7557ea53ab0cf7b44c04fd01545',
LanguageMap::create(array('en-US' => 'Text attachment')),
null,
null,
'some text content'
);
}
public static function getJSONAttachment()
{
return new Attachment(
IRI::fromString('http://id.tincanapi.com/attachment/supporting_media'),
'application/json',
60,
'f4135c31e2710764604195dfe4e225884d8108467cc21670803e384b80df88ee',
LanguageMap::create(array('en-US' => 'JSON attachment')),
null,
null,
'{"propertyA":"value1","propertyB":"value2","propertyC":true}'
);
}
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')
);
}
}

View File

@@ -0,0 +1,76 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\ContextActivities;
/**
* xAPI context activities fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class ContextActivitiesFixtures
{
public static function getEmptyContextActivities()
{
return new ContextActivities();
}
public static function getTypicalContextActivities()
{
return new ContextActivities();
}
public static function getCategoryOnlyContextActivities()
{
$contextActivities = new ContextActivities();
return $contextActivities->withAddedCategoryActivity(ActivityFixtures::getTypicalActivity());
}
public static function getParentOnlyContextActivities()
{
$contextActivities = new ContextActivities();
return $contextActivities->withAddedParentActivity(ActivityFixtures::getTypicalActivity());
}
public static function getGroupingOnlyContextActivities()
{
$contextActivities = new ContextActivities();
return $contextActivities->withAddedGroupingActivity(ActivityFixtures::getTypicalActivity());
}
public static function getOtherOnlyContextActivities()
{
$contextActivities = new ContextActivities();
return $contextActivities->withAddedOtherActivity(ActivityFixtures::getTypicalActivity());
}
public static function getAllPropertiesEmptyActivities()
{
return new ContextActivities(array(), array(), array(), array());
}
public static function getAllPropertiesActivities()
{
return new ContextActivities(
array(ActivityFixtures::getTypicalActivity()),
array(ActivityFixtures::getTypicalActivity()),
array(ActivityFixtures::getTypicalActivity()),
array(ActivityFixtures::getTypicalActivity())
);
}
}

View File

@@ -0,0 +1,134 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\Context;
/**
* xAPI context fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class ContextFixtures
{
public static function getEmptyContext()
{
return new Context();
}
public static function getTypicalContext()
{
return new Context();
}
public static function getTypicalAgentInstructorContext()
{
$context = new Context();
return $context->withInstructor(ActorFixtures::getTypicalAgent());
}
public static function getMboxAgentInstructorContext()
{
$context = new Context();
return $context->withInstructor(ActorFixtures::getMboxAgent());
}
public static function getMboxSha1SumAgentInstructorContext()
{
$context = new Context();
return $context->withInstructor(ActorFixtures::getMboxSha1SumAgent());
}
public static function getOpenIdAgentInstructorContext()
{
$context = new Context();
return $context->withInstructor(ActorFixtures::getOpenIdAgent());
}
public static function getAccountAgentInstructorContext()
{
$context = new Context();
return $context->withInstructor(ActorFixtures::getAccountAgent());
}
public static function getTypicalGroupTeamContext()
{
$context = new Context();
return $context->withTeam(ActorFixtures::getTypicalGroup());
}
public static function getStatementOnlyContext()
{
$context = new Context();
return $context->withStatement(StatementReferenceFixtures::getTypicalStatementReference());
}
public static function getExtensionsOnlyContext()
{
$context = new Context();
return $context->withExtensions(ExtensionsFixtures::getTypicalExtensions());
}
public static function getEmptyExtensionsOnlyContext()
{
$context = new Context();
return $context->withExtensions(ExtensionsFixtures::getEmptyExtensions());
}
public static function getEmptyContextActivitiesContext()
{
$context = new Context();
return $context->withContextActivities(ContextActivitiesFixtures::getEmptyContextActivities());
}
public static function getEmptyContextActivitiesAllPropertiesEmptyContext()
{
$context = new Context();
return $context->withContextActivities(ContextActivitiesFixtures::getAllPropertiesEmptyActivities());
}
public static function getContextActivitiesAllPropertiesOnlyContext()
{
$context = new Context();
return $context->withContextActivities(ContextActivitiesFixtures::getAllPropertiesActivities());
}
public static function getAllPropertiesContext()
{
$context = new Context();
$context = $context->withRegistration('16fd2706-8baf-433b-82eb-8c7fada847da')
->withInstructor(ActorFixtures::getTypicalAgent())
->withTeam(ActorFixtures::getTypicalGroup())
->withContextActivities(ContextActivitiesFixtures::getAllPropertiesActivities())
->withRevision('test')
->withPlatform('test')
->withLanguage('en-US')
->withStatement(StatementReferenceFixtures::getTypicalStatementReference())
->withExtensions(ExtensionsFixtures::getTypicalExtensions())
;
return $context;
}
}

View File

@@ -0,0 +1,167 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\Definition;
use Xabbuh\XApi\Model\Extensions;
use Xabbuh\XApi\Model\Interaction\ChoiceInteractionDefinition;
use Xabbuh\XApi\Model\Interaction\LikertInteractionDefinition;
use Xabbuh\XApi\Model\Interaction\MatchingInteractionDefinition;
use Xabbuh\XApi\Model\Interaction\PerformanceInteractionDefinition;
use Xabbuh\XApi\Model\Interaction\SequencingInteractionDefinition;
use Xabbuh\XApi\Model\IRI;
use Xabbuh\XApi\Model\IRL;
use Xabbuh\XApi\Model\LanguageMap;
use Xabbuh\XApi\Model\Interaction\FillInInteractionDefinition;
use Xabbuh\XApi\Model\Interaction\NumericInteractionDefinition;
use Xabbuh\XApi\Model\Interaction\OtherInteractionDefinition;
use Xabbuh\XApi\Model\Interaction\TrueFalseInteractionDefinition;
/**
* xAPI activity definition fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class DefinitionFixtures
{
public static function getEmptyDefinition()
{
return new Definition();
}
public static function getTypicalDefinition()
{
return new Definition();
}
public static function getNameDefinition()
{
return new Definition(LanguageMap::create(array('en-US' => 'test')));
}
public static function getDescriptionDefinition()
{
return new Definition(null, LanguageMap::create(array('en-US' => 'test')));
}
public static function getTypeDefinition()
{
return new Definition(null, null, IRI::fromString('http://id.tincanapi.com/activitytype/unit-test'));
}
public static function getMoreInfoDefinition()
{
return new Definition(null, null, null, IRL::fromString('https://github.com/adlnet/xAPI_LRS_Test'));
}
public static function getExtensionsDefinition()
{
$definition = new Definition();
$definition = $definition->withExtensions(ExtensionsFixtures::getMultiplePairsExtensions());
return $definition;
}
public static function getEmptyExtensionsDefinition()
{
$definition = new Definition();
$definition = $definition->withExtensions(ExtensionsFixtures::getEmptyExtensions());
return $definition;
}
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 static function getTrueFalseDefinition()
{
return new TrueFalseInteractionDefinition();
}
public static function getFillInDefinition()
{
return new FillInInteractionDefinition();
}
public static function getNumericDefinition()
{
return new NumericInteractionDefinition();
}
public static function getOtherDefinition()
{
return new OtherInteractionDefinition();
}
public static function getOtherWithCorrectResponsesPatternDefinition()
{
$otherDefinition = new OtherInteractionDefinition();
$otherDefinition = $otherDefinition->withCorrectResponsesPattern(array('test'));
return $otherDefinition;
}
public static function getChoiceDefinition()
{
$choiceDefinition = new ChoiceInteractionDefinition();
$choiceDefinition = $choiceDefinition->withChoices(array(InteractionComponentFixtures::getTypicalInteractionComponent()));
return $choiceDefinition;
}
public static function getSequencingDefinition()
{
$sequencingDefinition = new SequencingInteractionDefinition();
$sequencingDefinition = $sequencingDefinition->withChoices(array(InteractionComponentFixtures::getTypicalInteractionComponent()));
return $sequencingDefinition;
}
public static function getLikertDefinition()
{
$likertDefinition = new LikertInteractionDefinition();
$likertDefinition = $likertDefinition->withScale(array(InteractionComponentFixtures::getTypicalInteractionComponent()));
return $likertDefinition;
}
public static function getMatchingDefinition()
{
$matchingDefinition = new MatchingInteractionDefinition();
$matchingDefinition = $matchingDefinition->withSource(array(InteractionComponentFixtures::getTypicalInteractionComponent()));
$matchingDefinition = $matchingDefinition->withTarget(array(InteractionComponentFixtures::getTypicalInteractionComponent()));
return $matchingDefinition;
}
public static function getPerformanceDefinition()
{
$performanceDefinition = new PerformanceInteractionDefinition();
$performanceDefinition = $performanceDefinition->withSteps(array(InteractionComponentFixtures::getTypicalInteractionComponent()));
return $performanceDefinition;
}
public static function getForQueryDefinition()
{
return new Definition(LanguageMap::create(array('en-US' => 'for query')));
}
}

View File

@@ -0,0 +1,108 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\Activity;
use Xabbuh\XApi\Model\ActivityProfile;
use Xabbuh\XApi\Model\ActivityProfileDocument;
use Xabbuh\XApi\Model\Agent;
use Xabbuh\XApi\Model\AgentProfile;
use Xabbuh\XApi\Model\AgentProfileDocument;
use Xabbuh\XApi\Model\DocumentData;
use Xabbuh\XApi\Model\InverseFunctionalIdentifier;
use Xabbuh\XApi\Model\IRI;
use Xabbuh\XApi\Model\State;
use Xabbuh\XApi\Model\StateDocument;
/**
* Document fixtures.
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
class DocumentFixtures
{
/**
* Loads empty document data.
*
* @return DocumentData
*/
public static function getEmptyDocumentData()
{
return new DocumentData();
}
/**
* Loads document data.
*
* @return DocumentData
*/
public static function getDocumentData()
{
return new DocumentData(array('x' => 'foo', 'y' => 'bar'));
}
/**
* Loads an activity profile document.
*
* @param DocumentData $documentData The document data, by default, a some
* default data will be used
*
* @return ActivityProfileDocument
*/
public static function getActivityProfileDocument(DocumentData $documentData = null)
{
if (null === $documentData) {
$documentData = static::getDocumentData();
}
$activityProfile = new ActivityProfile('profile-id', new Activity(IRI::fromString('activity-id')));
return new ActivityProfileDocument($activityProfile, $documentData);
}
/**
* Loads an agent profile document.
*
* @param DocumentData $documentData The document data, by default, a some
* default data will be used
*
* @return AgentProfileDocument
*/
public static function getAgentProfileDocument(DocumentData $documentData = null)
{
if (null === $documentData) {
$documentData = static::getDocumentData();
}
return new AgentProfileDocument(new AgentProfile('profile-id', new Agent(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:christian@example.com')))), $documentData);
}
/**
* Loads a state document.
*
* @param DocumentData $documentData The document data, by default, a some
* default data will be used
*
* @return StateDocument
*/
public static function getStateDocument(DocumentData $documentData = null)
{
if (null === $documentData) {
$documentData = static::getDocumentData();
}
$agent = new Agent(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:alice@example.com')));
$activity = new Activity(IRI::fromString('activity-id'));
return new StateDocument(new State($activity, $agent, 'state-id'), $documentData);
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\Extensions;
use Xabbuh\XApi\Model\IRI;
/**
* xAPI statement extensions fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class ExtensionsFixtures
{
public static function getEmptyExtensions()
{
return new Extensions();
}
public static function getTypicalExtensions()
{
$extensions = new \SplObjectStorage();
$extensions->attach(IRI::fromString('http://id.tincanapi.com/extension/topic'), 'Conformance Testing');
return new Extensions($extensions);
}
public static function getWithObjectValueExtensions()
{
$extensions = new \SplObjectStorage();
$extensions->attach(IRI::fromString('http://id.tincanapi.com/extension/color'), array(
'model' => 'RGB',
'value' => '#FFFFFF',
));
return new Extensions($extensions);
}
public static function getWithIntegerValueExtensions()
{
$extensions = new \SplObjectStorage();
$extensions->attach(IRI::fromString('http://id.tincanapi.com/extension/starting-position'), 1);
return new Extensions($extensions);
}
public static function getMultiplePairsExtensions()
{
$extensions = new \SplObjectStorage();
$extensions->attach(IRI::fromString('http://id.tincanapi.com/extension/topic'), 'Conformance Testing');
$extensions->attach(IRI::fromString('http://id.tincanapi.com/extension/color'), array(
'model' => 'RGB',
'value' => '#FFFFFF',
));
$extensions->attach(IRI::fromString('http://id.tincanapi.com/extension/starting-position'), 1);
return new Extensions($extensions);
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\Interaction\InteractionComponent;
use Xabbuh\XApi\Model\LanguageMap;
/**
* xAPI statement activity interaction component fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class InteractionComponentFixtures
{
public static function getTypicalInteractionComponent()
{
return new InteractionComponent('test');
}
public static function getIdOnlyInteractionComponent()
{
return new InteractionComponent('test');
}
public static function getAllPropertiesInteractionComponent()
{
return new InteractionComponent('test', LanguageMap::create(array('en-US' => 'test')));
}
}

View File

@@ -0,0 +1,193 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\Result;
/**
* xAPI result fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class ResultFixtures
{
public static function getEmptyResult()
{
return new Result();
}
public static function getTypicalResult()
{
return new Result();
}
public static function getScoreResult()
{
return new Result(ScoreFixtures::getTypicalScore());
}
public static function getEmptyScoreResult()
{
return new Result(ScoreFixtures::getEmptyScore());
}
public static function getSuccessResult()
{
return new Result(null, true);
}
public static function getCompletionResult()
{
return new Result(null, null, true);
}
public static function getResponseResult()
{
return new Result(null, null, null, 'test');
}
public static function getDurationResult()
{
return new Result(null, null, null, null, 'PT2H');
}
public static function getExtensionsResult()
{
return new Result(null, null, null, null, null, ExtensionsFixtures::getMultiplePairsExtensions());
}
public static function getEmptyExtensionsResult()
{
return new Result(null, null, null, null, null, ExtensionsFixtures::getEmptyExtensions());
}
public static function getScoreAndSuccessResult()
{
return new Result(ScoreFixtures::getTypicalScore(), true);
}
public static function getScoreAndCompletionResult()
{
return new Result(ScoreFixtures::getTypicalScore(), null, true);
}
public static function getScoreAndResponseResult()
{
return new Result(ScoreFixtures::getTypicalScore(), null, null, 'test');
}
public static function getScoreAndDurationResult()
{
return new Result(ScoreFixtures::getTypicalScore(), null, null, null, 'PT2H');
}
public static function getSuccessAndCompletionResult()
{
return new Result(null, true, true);
}
public static function getSuccessAndResponseResult()
{
return new Result(null, true, null, 'test');
}
public static function getSuccessAndDurationResult()
{
return new Result(null, true, null, null, 'PT2H');
}
public static function getCompletionAndResponseResult()
{
return new Result(null, null, true, 'test');
}
public static function getCompletionAndDurationResult()
{
return new Result(null, null, true, null, 'PT2H');
}
public static function getResponseAndDurationResult()
{
return new Result(null, null, null, 'test', 'PT2H');
}
public static function getScoreSuccessAndCompletionResult()
{
return new Result(ScoreFixtures::getTypicalScore(), true, true);
}
public static function getScoreSuccessAndResponseResult()
{
return new Result(ScoreFixtures::getTypicalScore(), true, null, 'test');
}
public static function getScoreSuccessAndDurationResult()
{
return new Result(ScoreFixtures::getTypicalScore(), true, null, null, 'PT2H');
}
public static function getScoreCompletionAndResponseResult()
{
return new Result(ScoreFixtures::getTypicalScore(), null, true, 'test');
}
public static function getScoreCompletionAndDurationResult()
{
return new Result(ScoreFixtures::getTypicalScore(), null, true, null, 'PT2H');
}
public static function getScoreResponseAndDurationResult()
{
return new Result(ScoreFixtures::getTypicalScore(), null, null, 'test', 'PT2H');
}
public static function getSuccessCompletionAndResponseResult()
{
return new Result(null, true, true, 'test');
}
public static function getSuccessCompletionAndDurationResult()
{
return new Result(null, true, true, null, 'PT2H');
}
public static function getSuccessResponseAndDurationResult()
{
return new Result(null, true, null, 'test', 'PT2H');
}
public static function getCompletionResponseAndDurationResult()
{
return new Result(null, null, true, 'test', 'PT2H');
}
public static function getScoreSuccessCompletionAndResponseResult()
{
return new Result(ScoreFixtures::getTypicalScore(), true, true, 'test');
}
public static function getScoreSuccessCompletionAndDurationResult()
{
return new Result(ScoreFixtures::getTypicalScore(), true, true, null, 'PT2H');
}
public static function getSuccessCompletionResponseAndDurationResult()
{
return new Result(null, true, true, 'test', 'PT2H');
}
public static function getAllPropertiesResult()
{
return new Result(ScoreFixtures::getTypicalScore(), true, true, 'test', 'PT2H', ExtensionsFixtures::getTypicalExtensions());
}
}

View File

@@ -0,0 +1,103 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\Score;
/**
* xAPI score fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class ScoreFixtures
{
public static function getEmptyScore()
{
return new Score();
}
public static function getTypicalScore()
{
return new Score(1);
}
public static function getScaledScore()
{
return new Score(1);
}
public static function getRawScore()
{
return new Score(null, 100);
}
public static function getMinScore()
{
return new Score(null, null, 0);
}
public static function getMaxScore()
{
return new Score(null, null, null, 100);
}
public static function getScaledAndRawScore()
{
return new Score(1, 100);
}
public static function getScaledAndMinScore()
{
return new Score(1, null, 0);
}
public static function getScaledAndMaxScore()
{
return new Score(1, null, null, 100);
}
public static function getRawAndMinScore()
{
return new Score(null, 100, 0);
}
public static function getRawAndMaxScore()
{
return new Score(null, 100, null, 100);
}
public static function getMinAndMaxScore()
{
return new Score(null, null, 0, 100);
}
public static function getScaledRawAndMinScore()
{
return new Score(1, 100, 0);
}
public static function getScaledRawAndMaxScore()
{
return new Score(1, 100, null, 100);
}
public static function getRawMinAndMaxScore()
{
return new Score(null, 100, 0, 100);
}
public static function getAllPropertiesScore()
{
return new Score(1, 100, 0, 100);
}
}

View File

@@ -0,0 +1,234 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\Agent;
use Xabbuh\XApi\Model\Activity;
use Xabbuh\XApi\Model\Definition;
use Xabbuh\XApi\Model\InverseFunctionalIdentifier;
use Xabbuh\XApi\Model\IRI;
use Xabbuh\XApi\Model\LanguageMap;
use Xabbuh\XApi\Model\Statement;
use Xabbuh\XApi\Model\StatementId;
use Xabbuh\XApi\Model\StatementReference;
use Xabbuh\XApi\Model\SubStatement;
use Xabbuh\XApi\Model\Verb;
/**
* xAPI statement fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class StatementFixtures
{
const DEFAULT_STATEMENT_ID = '12345678-1234-5678-8234-567812345678';
public static function getMinimalStatement($id = self::DEFAULT_STATEMENT_ID)
{
if (null === $id) {
$id = UuidFixtures::getUniqueUuid();
}
return new Statement(StatementId::fromString($id), ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity());
}
public static function getTypicalStatement($id = self::DEFAULT_STATEMENT_ID)
{
if (null === $id) {
$id = UuidFixtures::getUniqueUuid();
}
return new Statement(StatementId::fromString($id), ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity(), null, null, new \DateTime('2014-07-23T12:34:02-05:00'));
}
public static function getVoidingStatement($id = null, $voidedStatementId = 'e05aa883-acaf-40ad-bf54-02c8ce485fb0')
{
if (null === $id) {
$id = UuidFixtures::getUniqueUuid();
}
return new Statement(StatementId::fromString($id), ActorFixtures::getTypicalAgent(), VerbFixtures::getVoidingVerb(), new StatementReference(StatementId::fromString($voidedStatementId)));
}
public static function getAttachmentStatement()
{
return new Statement(null, ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity(), null, null, null, null, null, array(AttachmentFixtures::getTextAttachment()));
}
/**
* Loads a statement with a group as an actor.
*
* @param string $id The id of the new Statement
*
* @return Statement
*/
public static function getStatementWithGroupActor($id = self::DEFAULT_STATEMENT_ID)
{
if (null === $id) {
$id = UuidFixtures::getUniqueUuid();
}
$group = ActorFixtures::getTypicalGroup();
$verb = VerbFixtures::getTypicalVerb();
$activity = ActivityFixtures::getTypicalActivity();
return new Statement(StatementId::fromString($id), $group, $verb, $activity);
}
/**
* Loads a statement with a group that has no members as an actor.
*
* @param string $id The id of the new Statement
*
* @return Statement
*/
public static function getStatementWithGroupActorWithoutMembers($id = self::DEFAULT_STATEMENT_ID)
{
if (null === $id) {
$id = UuidFixtures::getUniqueUuid();
}
$group = ActorFixtures::getTypicalGroup();
$verb = VerbFixtures::getTypicalVerb();
$activity = ActivityFixtures::getTypicalActivity();
return new Statement(StatementId::fromString($id), $group, $verb, $activity);
}
/**
* Loads a statement including a reference to another statement.
*
* @param string $id The id of the new Statement
*
* @return Statement
*/
public static function getStatementWithStatementRef($id = self::DEFAULT_STATEMENT_ID)
{
$minimalStatement = static::getMinimalStatement($id);
return new Statement(
$minimalStatement->getId(),
$minimalStatement->getActor(),
$minimalStatement->getVerb(),
new StatementReference(StatementId::fromString('8f87ccde-bb56-4c2e-ab83-44982ef22df0'))
);
}
/**
* Loads a statement including a result.
*
* @param string $id The id of the new Statement
*
* @return Statement
*/
public static function getStatementWithResult($id = self::DEFAULT_STATEMENT_ID)
{
if (null === $id) {
$id = UuidFixtures::getUniqueUuid();
}
return new Statement(StatementId::fromString($id), ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity(), ResultFixtures::getScoreAndDurationResult());
}
/**
* 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);
}
/**
* Loads a statement including an agent authority.
*
* @param string $id The id of the new Statement
*
* @return Statement
*/
public static function getStatementWithAgentAuthority($id = self::DEFAULT_STATEMENT_ID)
{
if (null === $id) {
$id = UuidFixtures::getUniqueUuid();
}
return new Statement(StatementId::fromString($id), ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity(), null, ActorFixtures::getAccountAgent());
}
/**
* Loads a statement including a group authority.
*
* @param string $id The id of the new Statement
*
* @return Statement
*/
public static function getStatementWithGroupAuthority($id = self::DEFAULT_STATEMENT_ID)
{
if (null === $id) {
$id = UuidFixtures::getUniqueUuid();
}
return new Statement(StatementId::fromString($id), ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity(), null, ActorFixtures::getTypicalGroup());
}
public static function getAllPropertiesStatement($id = self::DEFAULT_STATEMENT_ID)
{
if (null === $id) {
$id = UuidFixtures::getUniqueUuid();
}
return new Statement(
StatementId::fromString($id),
ActorFixtures::getTypicalAgent(),
VerbFixtures::getTypicalVerb(),
ActivityFixtures::getTypicalActivity(),
ResultFixtures::getAllPropertiesResult(),
ActorFixtures::getAccountAgent(),
new \DateTime('2013-05-18T05:32:34+00:00'),
new \DateTime('2014-07-23T12:34:02-05:00'),
ContextFixtures::getAllPropertiesContext(),
array(AttachmentFixtures::getTextAttachment())
);
}
/**
* @return Statement[]
*/
public static function getStatementCollection()
{
return array(
self::getMinimalStatement('12345678-1234-5678-8234-567812345678'),
self::getMinimalStatement('12345678-1234-5678-8234-567812345679'),
);
}
}

View File

@@ -0,0 +1,34 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\StatementId;
use Xabbuh\XApi\Model\StatementReference;
/**
* xAPI statement reference fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class StatementReferenceFixtures
{
public static function getTypicalStatementReference()
{
return new StatementReference(StatementId::fromString('16fd2706-8baf-433b-82eb-8c7fada847da'));
}
public static function getAllPropertiesStatementReference()
{
return new StatementReference(StatementId::fromString('16fd2706-8baf-433b-82eb-8c7fada847da'));
}
}

View File

@@ -0,0 +1,66 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\Agent;
use Xabbuh\XApi\Model\InverseFunctionalIdentifier;
use Xabbuh\XApi\Model\IRI;
use Xabbuh\XApi\Model\IRL;
use Xabbuh\XApi\Model\LanguageMap;
use Xabbuh\XApi\Model\Statement;
use Xabbuh\XApi\Model\StatementId;
use Xabbuh\XApi\Model\StatementResult;
use Xabbuh\XApi\Model\Verb;
/**
* Statement result fixtures.
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
class StatementResultFixtures
{
/**
* 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;
}
/**
* 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;
}
}

View File

@@ -0,0 +1,133 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\SubStatement;
/**
* xAPI sub statement fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class SubStatementFixtures
{
public static function getTypicalSubStatement()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity());
}
public static function getSubStatementWithMboxAgent()
{
return new SubStatement(ActorFixtures::getMboxAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity());
}
public static function getSubStatementWithMboxSha1SumAgent()
{
return new SubStatement(ActorFixtures::getMboxSha1SumAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity());
}
public static function getSubStatementWithOpenIdAgent()
{
return new SubStatement(ActorFixtures::getOpenIdAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity());
}
public static function getSubStatementWithAccountAgent()
{
return new SubStatement(ActorFixtures::getAccountAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity());
}
public static function getSubStatementWithMboxGroup()
{
return new SubStatement(ActorFixtures::getMboxGroup(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity());
}
public static function getSubStatementWithMboxSha1SumGroup()
{
return new SubStatement(ActorFixtures::getMboxSha1SumGroup(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity());
}
public static function getSubStatementWithOpenIdGroup()
{
return new SubStatement(ActorFixtures::getOpenIdGroup(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity());
}
public static function getSubStatementWithAccountGroup()
{
return new SubStatement(ActorFixtures::getAccountGroup(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity());
}
public static function getSubStatementWithIdOnlyVerb()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getIdVerb(), ActivityFixtures::getTypicalActivity());
}
public static function getSubStatementWithMboxAgentObject()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActorFixtures::getMboxAgent());
}
public static function getSubStatementWithMboxSha1SumAgentObject()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActorFixtures::getMboxSha1SumAgent());
}
public static function getSubStatementWithOpenIdAgentObject()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActorFixtures::getOpenIdAgent());
}
public static function getSubStatementWithAccountAgentObject()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActorFixtures::getAccountAgent());
}
public static function getSubStatementWithMboxGroupObject()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActorFixtures::getMboxGroup());
}
public static function getSubStatementWithMboxSha1SumGroupObject()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActorFixtures::getMboxSha1SumGroup());
}
public static function getSubStatementWithOpenIdGroupObject()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActorFixtures::getOpenIdGroup());
}
public static function getSubStatementWithAccountGroupObject()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActorFixtures::getAccountGroup());
}
public static function getSubStatementWithAllPropertiesAndTypicalAgentMemberGroupObject()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActorFixtures::getAllPropertiesAndTypicalAgentMemberGroup());
}
public static function getSubStatementWithAllPropertiesActivityObject()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getAllPropertiesActivity());
}
public static function getSubStatementWithTypicalStatementReferenceObject()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), StatementReferenceFixtures::getTypicalStatementReference());
}
public static function getAllPropertiesSubStatement()
{
return new SubStatement(ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::getTypicalActivity(), ResultFixtures::getTypicalResult(), ContextFixtures::getTypicalContext());
}
}

View File

@@ -0,0 +1,43 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Ramsey\Uuid\Uuid as RamseyUuid;
use Rhumsaa\Uuid\Uuid as RhumsaaUuid;
/**
* xAPI UUID fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class UuidFixtures
{
public static function getGoodUuid()
{
return '39e24cc4-69af-4b01-a824-1fdc6ea8a3af';
}
public static function getBadUuid()
{
return 'bad-uuid';
}
public static function getUniqueUuid()
{
if (class_exists('Rhumsaa\Uuid\Uuid')) {
return (string) RhumsaaUuid::uuid4();
}
return (string) RamseyUuid::uuid4();
}
}

View File

@@ -0,0 +1,50 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\DataFixtures;
use Xabbuh\XApi\Model\IRI;
use Xabbuh\XApi\Model\LanguageMap;
use Xabbuh\XApi\Model\Verb;
/**
* xAPI verb fixtures.
*
* These fixtures are borrowed from the
* {@link https://github.com/adlnet/xAPI_LRS_Test Experience API Learning Record Store Conformance Test} package.
*/
class VerbFixtures
{
public static function getTypicalVerb()
{
return new Verb(IRI::fromString('http://tincanapi.com/conformancetest/verbid'), LanguageMap::create(array('en-US' => 'test')));
}
public static function getVoidingVerb()
{
return new Verb(IRI::fromString('http://adlnet.gov/expapi/verbs/voided'), LanguageMap::create(array('en-US' => 'voided')));
}
public static function getIdVerb()
{
return new Verb(IRI::fromString('http://tincanapi.com/conformancetest/verbid'));
}
public static function getIdAndDisplayVerb()
{
return new Verb(IRI::fromString('http://tincanapi.com/conformancetest/verbid'), LanguageMap::create(array('en-US' => 'test')));
}
public static function getForQueryVerb()
{
return new Verb(IRI::fromString('http://tincanapi.com/conformancetest/verbid/forQuery'), LanguageMap::create(array('en-US' => 'for query')));
}
}

View File

@@ -0,0 +1,40 @@
<?php
include __DIR__.'/vendor/autoload.php';
$status = 0;
$typeMap = array(
'Xabbuh\XApi\DataFixtures\StatementFixtures::getStatementCollection' => 'array',
'Xabbuh\XApi\DataFixtures\UuidFixtures' => 'string',
);
foreach (glob(__DIR__.'/src/*.php') as $path) {
$filename = substr(basename($path), 0, -4);
$fixturesClassName = 'Xabbuh\XApi\DataFixtures\\'.$filename;
foreach (get_class_methods($fixturesClassName) as $method) {
$object = call_user_func(array($fixturesClassName, $method));
if (isset($typeMap[$fixturesClassName.'::'.$method])) {
$type = $typeMap[$fixturesClassName.'::'.$method];
} elseif (isset($typeMap[$fixturesClassName])) {
$type = $typeMap[$fixturesClassName];
} else {
$type = 'object';
}
if (gettype($object) !== $type) {
file_put_contents('php://stderr', sprintf(
'Expected %s::%s to return data of type "%s", but got "%s"'.PHP_EOL,
$filename,
$method,
$type,
gettype($object)
));
$status = 1;
}
}
}
exit($status);