|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Majora\Framework\Serializer\Tests\Model; |
|
4
|
|
|
|
|
5
|
|
|
use Majora\Framework\Serializer\Model\SerializableInterface; |
|
6
|
|
|
use Majora\Framework\Serializer\Model\SerializableTrait; |
|
7
|
|
|
|
|
8
|
|
|
class SerializableMock1 implements SerializableInterface |
|
9
|
|
|
{ |
|
10
|
|
|
use SerializableTrait; |
|
11
|
|
|
|
|
12
|
|
|
protected $id = 1; |
|
13
|
|
|
protected $label = 'mock_1_label'; |
|
14
|
|
|
protected $table = array('mock_1_1', 'mock_1_2'); |
|
15
|
|
|
protected $protect; |
|
16
|
|
|
protected $mock2; |
|
17
|
|
|
protected $mock3; |
|
18
|
|
|
protected $callback; |
|
19
|
|
|
protected $date; |
|
20
|
|
|
protected $optionnal_empty; |
|
21
|
|
|
protected $optionnal_defined = 'optionnal_mocked'; |
|
22
|
|
|
|
|
23
|
|
|
public function __construct() |
|
24
|
|
|
{ |
|
25
|
|
|
$this->mock2 = new SerializableMock2(); |
|
26
|
|
|
$this->date = new \DateTime('2015-01-01'); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function getId() |
|
30
|
|
|
{ |
|
31
|
|
|
return $this->id; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function setId($id) |
|
35
|
|
|
{ |
|
36
|
|
|
$this->id = $id; |
|
37
|
|
|
|
|
38
|
|
|
return $this; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function setProtectedProtect($protect) |
|
42
|
|
|
{ |
|
43
|
|
|
$this->protect = $protect; |
|
44
|
|
|
|
|
45
|
|
|
return $this; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function getLabel() |
|
49
|
|
|
{ |
|
50
|
|
|
return $this->label; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function setLabel($label) |
|
54
|
|
|
{ |
|
55
|
|
|
$this->label = $label; |
|
56
|
|
|
|
|
57
|
|
|
return $this; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function getTable() |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->table; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function setTable(array $table) |
|
66
|
|
|
{ |
|
67
|
|
|
$this->table = $table; |
|
68
|
|
|
|
|
69
|
|
|
return $this; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
public function getMock2() |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->mock2; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function setMock2(SerializableMock2 $mock2) |
|
78
|
|
|
{ |
|
79
|
|
|
$this->mock2 = $mock2; |
|
80
|
|
|
|
|
81
|
|
|
return $this; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function getMock3() |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->mock3; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
public function setMock3(SimpleClassMock $mock3) |
|
90
|
|
|
{ |
|
91
|
|
|
$this->mock3 = $mock3; |
|
92
|
|
|
|
|
93
|
|
|
return $this; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function getDate() |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->date; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
public function setDate(\DateTime $date) |
|
102
|
|
|
{ |
|
103
|
|
|
$this->date = $date; |
|
104
|
|
|
|
|
105
|
|
|
return $this; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
public function getCallback() |
|
109
|
|
|
{ |
|
110
|
|
|
return $this->callback; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
public function setCallback(callable $callback) |
|
114
|
|
|
{ |
|
115
|
|
|
$this->callback = $callback; |
|
116
|
|
|
|
|
117
|
|
|
return $this; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* @see ScopableInterface::getScopes() |
|
122
|
|
|
*/ |
|
123
|
|
|
public static function getScopes() |
|
124
|
|
|
{ |
|
125
|
|
|
return array( |
|
126
|
|
|
'default' => array('id', 'label'), |
|
127
|
|
|
'id' => 'id', |
|
128
|
|
|
'full' => array('@default', 'table', 'optionnal_empty?', 'optionnal_defined?', 'date', 'mock2@id'), |
|
129
|
|
|
'extra' => array('@full', 'mock2'), |
|
130
|
|
|
); |
|
131
|
|
|
} |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
class SimpleClassMock |
|
135
|
|
|
{ |
|
136
|
|
|
public $ganon; |
|
137
|
|
|
} |
|
138
|
|
|
|