1
1
<?php
2
- namespace Viserio \Container \Test ;
2
+ namespace Viserio \Container \Tests ;
3
3
4
4
use Viserio \Container \Container ;
5
5
use Viserio \Container \Definition ;
@@ -31,15 +31,15 @@ public function setUp()
31
31
*/
32
32
public function testConstruct ()
33
33
{
34
- $ definition = new Definition ($ this ->container , 'Viserio \\Test \\Container \\Qux ' );
34
+ $ definition = new Definition ($ this ->container , 'Viserio \\Tests \\Container \\Qux ' );
35
35
$ this ->assertAttributeInstanceOf (
36
36
'Viserio \\Container \\Container ' ,
37
37
'container ' ,
38
38
$ definition ,
39
39
'The passed container name should be assigned to the $container property. '
40
40
);
41
41
$ this ->assertAttributeEquals (
42
- 'Viserio \\Test \\Container \\Qux ' ,
42
+ 'Viserio \\Tests \\Container \\Qux ' ,
43
43
'class ' ,
44
44
$ definition ,
45
45
'The passed class name should be assigned to the $class property. '
@@ -51,10 +51,10 @@ public function testConstruct()
51
51
*/
52
52
public function testInvokeNoArgsOrMethodCalls ()
53
53
{
54
- $ definition = new Definition ($ this ->container , 'Viserio \\Test \\Container \\Qux ' );
54
+ $ definition = new Definition ($ this ->container , 'Viserio \\Tests \\Container \\Qux ' );
55
55
$ instance = $ definition ();
56
56
$ this ->assertInstanceOf (
57
- 'Viserio \\Test \\Container \\Qux ' ,
57
+ 'Viserio \\Tests \\Container \\Qux ' ,
58
58
$ instance ,
59
59
'Invoking the Definition class should return an instance of the class $class. '
60
60
);
@@ -65,22 +65,22 @@ public function testInvokeNoArgsOrMethodCalls()
65
65
*/
66
66
public function testInvokeWithArgs ()
67
67
{
68
- $ definition = new Definition ($ this ->container , 'Viserio \\Test \\Container \\Foo ' );
69
- $ definition ->withArgument ('Viserio \\Test \\Container \\Bar ' )->withArgument ('Viserio \\Test \\Container \\Baz ' );
68
+ $ definition = new Definition ($ this ->container , 'Viserio \\Tests \\Container \\Foo ' );
69
+ $ definition ->withArgument ('Viserio \\Tests \\Container \\Bar ' )->withArgument ('Viserio \\Tests \\Container \\Baz ' );
70
70
$ instance = $ definition ();
71
71
$ this ->assertInstanceOf (
72
- 'Viserio \\Test \\Container \\Foo ' ,
72
+ 'Viserio \\Tests \\Container \\Foo ' ,
73
73
$ instance ,
74
74
'Invoking a Definition should return an instance of the class defined in the $class property. '
75
75
);
76
76
$ this ->assertAttributeInstanceOf (
77
- 'Viserio \\Test \\Container \\Bar ' ,
77
+ 'Viserio \\Tests \\Container \\Bar ' ,
78
78
'bar ' ,
79
79
$ instance ,
80
80
'Invoking a Definition with arguments assigned should pass those args to the method. '
81
81
);
82
82
$ this ->assertAttributeInstanceOf (
83
- 'Viserio \\Test \\Container \\Baz ' ,
83
+ 'Viserio \\Tests \\Container \\Baz ' ,
84
84
'baz ' ,
85
85
$ instance ,
86
86
'Invoking a Definition with arguments assigned should pass those args to the method. '
@@ -93,8 +93,8 @@ public function testInvokeWithArgs()
93
93
public function testInvokeWithInheritedArgs ()
94
94
{
95
95
$ int = rand (1 , 5000 );
96
- $ this ->container ->bind ('Viserio \\Test \\Container \\CorgeInterface ' )->withArgument ($ int );
97
- $ definition = new Definition ($ this ->container , 'Viserio \\Test \\Container \\Corge ' );
96
+ $ this ->container ->bind ('Viserio \\Tests \\Container \\CorgeInterface ' )->withArgument ($ int );
97
+ $ definition = new Definition ($ this ->container , 'Viserio \\Tests \\Container \\Corge ' );
98
98
$ instance = $ definition ();
99
99
$ this ->assertAttributeEquals (
100
100
$ int ,
@@ -109,11 +109,11 @@ public function testInvokeWithInheritedArgs()
109
109
*/
110
110
public function testInvokeWithIntegerAsArg ()
111
111
{
112
- $ definition = new Definition ($ this ->container , 'Viserio \\Test \\Container \\Corge ' );
112
+ $ definition = new Definition ($ this ->container , 'Viserio \\Tests \\Container \\Corge ' );
113
113
$ definition ->withArgument (1 );
114
114
$ instance = $ definition ();
115
115
$ this ->assertInstanceOf (
116
- 'Viserio \\Test \\Container \\Corge ' ,
116
+ 'Viserio \\Tests \\Container \\Corge ' ,
117
117
$ instance ,
118
118
'Invoking a Definition should return an instance of the class defined in the $class property. '
119
119
);
@@ -130,16 +130,16 @@ public function testInvokeWithIntegerAsArg()
130
130
*/
131
131
public function testInvokeWithMethodCall ()
132
132
{
133
- $ definition = new Definition ($ this ->container , 'Viserio \\Test \\Container \\Qux ' );
134
- $ definition ->withMethodCall ('setBar ' , ['Viserio \\Test \\Container \\Bar ' ]);
133
+ $ definition = new Definition ($ this ->container , 'Viserio \\Tests \\Container \\Qux ' );
134
+ $ definition ->withMethodCall ('setBar ' , ['Viserio \\Tests \\Container \\Bar ' ]);
135
135
$ instance = $ definition ();
136
136
$ this ->assertInstanceOf (
137
- 'Viserio \\Test \\Container \\Qux ' ,
137
+ 'Viserio \\Tests \\Container \\Qux ' ,
138
138
$ instance ,
139
139
'Invoking a Definition should return an instance of the class defined in the $class property. '
140
140
);
141
141
$ this ->assertAttributeInstanceOf (
142
- 'Viserio \\Test \\Container \\Bar ' ,
142
+ 'Viserio \\Tests \\Container \\Bar ' ,
143
143
'bar ' ,
144
144
$ instance ,
145
145
'Invoking a Definition with a defined method call pass the defined args to the method. '
@@ -152,9 +152,9 @@ public function testInvokeWithMethodCall()
152
152
public function testInvokeWithInheritedMethodCall ()
153
153
{
154
154
$ int = rand (1 , 5000 );
155
- $ this ->container ->bind ('Viserio \\Test \\Container \\CorgeInterface ' )
155
+ $ this ->container ->bind ('Viserio \\Tests \\Container \\CorgeInterface ' )
156
156
->withMethodCall ('setInt ' , [$ int ]);
157
- $ definition = new Definition ($ this ->container , 'Viserio \\Test \\Container \\Corge ' );
157
+ $ definition = new Definition ($ this ->container , 'Viserio \\Tests \\Container \\Corge ' );
158
158
$ instance = $ definition ();
159
159
$ this ->assertAttributeEquals (
160
160
$ int ,
@@ -169,7 +169,7 @@ public function testInvokeWithInheritedMethodCall()
169
169
*/
170
170
public function testWithArgument ()
171
171
{
172
- $ definition = new Definition ($ this ->container , 'Viserio \\Test \\Container \\Foo ' );
172
+ $ definition = new Definition ($ this ->container , 'Viserio \\Tests \\Container \\Foo ' );
173
173
$ definition ->withArgument ('foo ' );
174
174
$ this ->assertAttributeContains (
175
175
'foo ' ,
@@ -184,7 +184,7 @@ public function testWithArgument()
184
184
*/
185
185
public function testAddIntegerArg ()
186
186
{
187
- $ definition = new Definition ($ this ->container , 'Viserio \\Test \\Container \\Foo ' );
187
+ $ definition = new Definition ($ this ->container , 'Viserio \\Tests \\Container \\Foo ' );
188
188
$ definition ->withArgument (1 );
189
189
$ args = $ this ->readAttribute ($ definition , 'arguments ' );
190
190
$ this ->assertEquals (
@@ -199,7 +199,7 @@ public function testAddIntegerArg()
199
199
*/
200
200
public function testWithArguments ()
201
201
{
202
- $ definition = new Definition ($ this ->container , 'Viserio \\Test \\Container \\Foo ' );
202
+ $ definition = new Definition ($ this ->container , 'Viserio \\Tests \\Container \\Foo ' );
203
203
$ definition ->withArguments (['foo ' , 'bar ' ]);
204
204
$ this ->assertAttributeEquals (
205
205
['foo ' , 'bar ' ],
@@ -214,7 +214,7 @@ public function testWithArguments()
214
214
*/
215
215
public function testCleanArgs ()
216
216
{
217
- $ definition = new Definition ($ this ->container , 'Viserio \\Test \\Container \\Foo ' );
217
+ $ definition = new Definition ($ this ->container , 'Viserio \\Tests \\Container \\Foo ' );
218
218
$ definition ->withArguments (['foo ' , 'bar ' ]);
219
219
$ definition ->cleanArgument ();
220
220
$ this ->assertAttributeEquals (
@@ -227,8 +227,8 @@ public function testCleanArgs()
227
227
228
228
public function testWithMethod ()
229
229
{
230
- $ definition = new Definition ($ this ->container , 'Viserio \\Test \\Container \\Qux ' );
231
- $ definition ->withMethodCall ('setBar ' , ['Viserio \\Test \\Container \\Bar ' ]);
230
+ $ definition = new Definition ($ this ->container , 'Viserio \\Tests \\Container \\Qux ' );
231
+ $ definition ->withMethodCall ('setBar ' , ['Viserio \\Tests \\Container \\Bar ' ]);
232
232
$ methods = $ this ->readAttribute ($ definition , 'methods ' );
233
233
$ this ->assertArrayHasKey (
234
234
'setBar ' ,
@@ -239,7 +239,7 @@ public function testWithMethod()
239
239
240
240
public function testCallMethod ()
241
241
{
242
- $ definition = new Definition ($ this ->container , 'Viserio \\Test \\Container \\Corge ' );
242
+ $ definition = new Definition ($ this ->container , 'Viserio \\Tests \\Container \\Corge ' );
243
243
$ definition ->withMethodCall ('setInt ' , [1 ]);
244
244
$ reflection = new \ReflectionMethod ($ definition , 'callMethods ' );
245
245
$ reflection ->setAccessible (true );
0 commit comments