-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDocumentFixtures.php
More file actions
106 lines (93 loc) · 2.88 KB
/
DocumentFixtures.php
File metadata and controls
106 lines (93 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?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\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('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()), $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('mailto:alice@example.com');
$activity = new Activity('activity-id');
return new StateDocument(new State($activity, $agent, 'state-id'), $documentData);
}
}