1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the xAPI package. |
5
|
|
|
* |
6
|
|
|
* (c) Christian Flothmann <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Xabbuh\XApi\Serializer\Tests\Event; |
13
|
|
|
|
14
|
|
|
use Xabbuh\XApi\Serializer\Event\ObjectEventSubscriber; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @author Christian Flothmann <[email protected]> |
18
|
|
|
*/ |
19
|
|
View Code Duplication |
class ObjectEventSubscriberTest extends AddDataSubscriberTest |
|
|
|
|
20
|
|
|
{ |
21
|
|
|
protected function setUp() |
22
|
|
|
{ |
23
|
|
|
$this->eventSubscriber = new ObjectEventSubscriber(); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function getEventData() |
27
|
|
|
{ |
28
|
|
|
return array( |
29
|
|
|
array( |
30
|
|
|
array('name' => 'Xabbuh\XApi\Model\Object'), |
31
|
|
|
array( |
32
|
|
|
'id' => 'http://www.example.co.uk/exampleactivity', |
33
|
|
|
'definition' => array( |
34
|
|
|
'name' => array( |
35
|
|
|
'en-GB' => 'example activity', |
36
|
|
|
'en-US' => 'example activity', |
37
|
|
|
), |
38
|
|
|
'description' => array( |
39
|
|
|
'en-GB' => 'An example of an activity', |
40
|
|
|
'en-US' => 'An example of an activity', |
41
|
|
|
), |
42
|
|
|
'type' => 'http://www.example.co.uk/types/exampleactivitytype', |
43
|
|
|
), |
44
|
|
|
), |
45
|
|
|
array( |
46
|
|
|
'id' => 'http://www.example.co.uk/exampleactivity', |
47
|
|
|
'definition' => array( |
48
|
|
|
'name' => array( |
49
|
|
|
'en-GB' => 'example activity', |
50
|
|
|
'en-US' => 'example activity', |
51
|
|
|
), |
52
|
|
|
'description' => array( |
53
|
|
|
'en-GB' => 'An example of an activity', |
54
|
|
|
'en-US' => 'An example of an activity', |
55
|
|
|
), |
56
|
|
|
'type' => 'http://www.example.co.uk/types/exampleactivitytype', |
57
|
|
|
), |
58
|
|
|
'objectType' => 'Activity', |
59
|
|
|
), |
60
|
|
|
), |
61
|
|
|
array( |
62
|
|
|
array('name' => 'Xabbuh\XApi\Model\Object'), |
63
|
|
|
array( |
64
|
|
|
'name' => 'Example Group', |
65
|
|
|
'account' => array( |
66
|
|
|
'homePage' => 'http://example.com/homePage', |
67
|
|
|
'name' => 'GroupAccount', |
68
|
|
|
), |
69
|
|
|
'member' => array(), |
70
|
|
|
'objectType' => 'Group', |
71
|
|
|
), |
72
|
|
|
array( |
73
|
|
|
'name' => 'Example Group', |
74
|
|
|
'account' => array( |
75
|
|
|
'homePage' => 'http://example.com/homePage', |
76
|
|
|
'name' => 'GroupAccount', |
77
|
|
|
), |
78
|
|
|
'member' => array(), |
79
|
|
|
'objectType' => 'Group', |
80
|
|
|
), |
81
|
|
|
), |
82
|
|
|
array( |
83
|
|
|
array('name' => 'Xabbuh\XApi\Model\Actor'), |
84
|
|
|
array( |
85
|
|
|
'name' => 'Christian', |
86
|
|
|
'mbox' => 'mailto:[email protected]', |
87
|
|
|
), |
88
|
|
|
array( |
89
|
|
|
'name' => 'Christian', |
90
|
|
|
'mbox' => 'mailto:[email protected]', |
91
|
|
|
), |
92
|
|
|
), |
93
|
|
|
); |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.