@@ -29,17 +29,17 @@ public function __construct($name = null, array $data = [], $dataName = '') {
29
29
*/
30
30
public function testInit () {
31
31
$ expected = null ;
32
- $ result = Timer::$ collection ;
32
+ $ result = Timer::getCollection () ;
33
33
$ this ->assertEquals ($ expected , $ result );
34
34
35
35
Timer::init ();
36
36
37
37
$ expected = '\Xicrow\PhpDebug\Collection ' ;
38
- $ result = Timer::$ collection ;
38
+ $ result = Timer::getCollection () ;
39
39
$ this ->assertInstanceOf ($ expected , $ result );
40
40
41
41
$ expected = [];
42
- $ result = Timer::$ collection ->getAll ();
42
+ $ result = Timer::getCollection () ->getAll ();
43
43
$ this ->assertEquals ($ expected , $ result );
44
44
}
45
45
@@ -48,18 +48,18 @@ public function testInit() {
48
48
* @covers \Xicrow\PhpDebug\Profiler::add
49
49
*/
50
50
public function testAdd () {
51
- Timer::$ collection ->clear ();
51
+ Timer::getCollection () ->clear ();
52
52
53
53
$ expected = 0 ;
54
- $ result = Timer::$ collection ->count ();
54
+ $ result = Timer::getCollection () ->count ();
55
55
$ this ->assertEquals ($ expected , $ result );
56
56
57
57
$ expected = true ;
58
58
$ result = Timer::add ();
59
59
$ this ->assertEquals ($ expected , $ result );
60
60
61
61
$ expected = 1 ;
62
- $ result = Timer::$ collection ->count ();
62
+ $ result = Timer::getCollection () ->count ();
63
63
$ this ->assertEquals ($ expected , $ result );
64
64
}
65
65
@@ -69,18 +69,18 @@ public function testAdd() {
69
69
* @covers \Xicrow\PhpDebug\Profiler::start
70
70
*/
71
71
public function testStart () {
72
- Timer::$ collection ->clear ();
72
+ Timer::getCollection () ->clear ();
73
73
74
74
$ expected = 0 ;
75
- $ result = Timer::$ collection ->count ();
75
+ $ result = Timer::getCollection () ->count ();
76
76
$ this ->assertEquals ($ expected , $ result );
77
77
78
78
$ expected = true ;
79
79
$ result = Timer::start ();
80
80
$ this ->assertEquals ($ expected , $ result );
81
81
82
82
$ expected = 1 ;
83
- $ result = Timer::$ collection ->count ();
83
+ $ result = Timer::getCollection () ->count ();
84
84
$ this ->assertEquals ($ expected , $ result );
85
85
}
86
86
@@ -91,18 +91,18 @@ public function testStart() {
91
91
* @covers \Xicrow\PhpDebug\Profiler::stop
92
92
*/
93
93
public function testStop () {
94
- Timer::$ collection ->clear ();
94
+ Timer::getCollection () ->clear ();
95
95
96
96
$ expected = 0 ;
97
- $ result = Timer::$ collection ->count ();
97
+ $ result = Timer::getCollection () ->count ();
98
98
$ this ->assertEquals ($ expected , $ result );
99
99
100
100
$ expected = false ;
101
101
$ result = Timer::stop ();
102
102
$ this ->assertEquals ($ expected , $ result );
103
103
104
104
$ expected = 0 ;
105
- $ result = Timer::$ collection ->count ();
105
+ $ result = Timer::getCollection () ->count ();
106
106
$ this ->assertEquals ($ expected , $ result );
107
107
108
108
$ expected = true ;
@@ -114,7 +114,7 @@ public function testStop() {
114
114
$ this ->assertEquals ($ expected , $ result );
115
115
116
116
$ expected = 1 ;
117
- $ result = Timer::$ collection ->count ();
117
+ $ result = Timer::getCollection () ->count ();
118
118
$ this ->assertEquals ($ expected , $ result );
119
119
}
120
120
@@ -124,7 +124,7 @@ public function testStop() {
124
124
* @covers \Xicrow\PhpDebug\Profiler::custom
125
125
*/
126
126
public function testCustom () {
127
- Timer::$ collection ->clear ();
127
+ Timer::getCollection () ->clear ();
128
128
129
129
$ expected = true ;
130
130
$ result = Timer::custom ();
@@ -151,7 +151,7 @@ public function testCustom() {
151
151
* @covers \Xicrow\PhpDebug\Profiler::callback
152
152
*/
153
153
public function testCallback () {
154
- Timer::$ collection ->clear ();
154
+ Timer::getCollection () ->clear ();
155
155
156
156
$ expected = time ();
157
157
$ result = Timer::callback (null , 'time ' );
@@ -210,7 +210,7 @@ public function testCallback() {
210
210
* @covers \Xicrow\PhpDebug\Profiler::getStatsOneline
211
211
*/
212
212
public function testGetStats () {
213
- Timer::$ collection ->clear ();
213
+ Timer::getCollection () ->clear ();
214
214
215
215
$ expected = 'Unknow item in with key: foo ' ;
216
216
$ result = Timer::getStats ('foo ' );
@@ -238,22 +238,22 @@ public function testGetStats() {
238
238
* @covers \Xicrow\PhpDebug\Profiler::getStatsOneline
239
239
*/
240
240
public function testGetStatsOneline () {
241
- Timer::$ collection ->clear ();
241
+ Timer::getCollection () ->clear ();
242
242
243
243
$ timerName = 'Foo ' ;
244
244
Timer::custom ($ timerName , 0.1 , 0.2 );
245
245
246
- $ result = Timer::getStatsOneline (Timer::$ collection ->get ($ timerName ));
246
+ $ result = Timer::getStatsOneline (Timer::getCollection () ->get ($ timerName ));
247
247
$ this ->assertContains ($ timerName , $ result );
248
248
$ this ->assertContains ('100.0000 MS ' , $ result );
249
249
250
- $ result = Timer::getStatsOneline (Timer::$ collection ->get ($ timerName ), ['show_start_stop ' => true ]);
250
+ $ result = Timer::getStatsOneline (Timer::getCollection () ->get ($ timerName ), ['show_start_stop ' => true ]);
251
251
$ this ->assertContains (date ('Y-m-d H:i ' ), $ result );
252
252
253
253
$ timerName = 'Really, really, really, really, really, really, really, really, really, really, really, really, really long timer name ' ;
254
254
Timer::custom ($ timerName , 0.1 , 0.2 );
255
255
256
- $ result = Timer::getStatsOneline (Timer::$ collection ->get ($ timerName ));
256
+ $ result = Timer::getStatsOneline (Timer::getCollection () ->get ($ timerName ));
257
257
$ this ->assertContains (substr ($ timerName , -20 ), $ result );
258
258
$ this ->assertContains ('100.0000 MS ' , $ result );
259
259
}
@@ -265,22 +265,22 @@ public function testGetStatsOneline() {
265
265
* @covers \Xicrow\PhpDebug\Profiler::getStatsMultiline
266
266
*/
267
267
public function testGetStatsMultiline () {
268
- Timer::$ collection ->clear ();
268
+ Timer::getCollection () ->clear ();
269
269
270
270
$ timerName = 'Foo ' ;
271
271
Timer::custom ($ timerName , 0.1 , 0.2 );
272
272
273
- $ result = Timer::getStatsMultiline (Timer::$ collection ->get ($ timerName ));
273
+ $ result = Timer::getStatsMultiline (Timer::getCollection () ->get ($ timerName ));
274
274
$ this ->assertContains ($ timerName , $ result );
275
275
$ this ->assertContains ('100.0000 MS ' , $ result );
276
276
277
- $ result = Timer::getStatsMultiline (Timer::$ collection ->get ($ timerName ), ['show_start_stop ' => true ]);
277
+ $ result = Timer::getStatsMultiline (Timer::getCollection () ->get ($ timerName ), ['show_start_stop ' => true ]);
278
278
$ this ->assertContains (date ('Y-m-d H:i ' ), $ result );
279
279
280
280
$ timerName = 'Really, really, really, really, really, really, really, really, really, really, really, really, really long timer name ' ;
281
281
Timer::custom ($ timerName , 0.1 , 0.2 );
282
282
283
- $ result = Timer::getStatsMultiline (Timer::$ collection ->get ($ timerName ));
283
+ $ result = Timer::getStatsMultiline (Timer::getCollection () ->get ($ timerName ));
284
284
$ this ->assertContains ($ timerName , $ result );
285
285
$ this ->assertContains ('100.0000 MS ' , $ result );
286
286
}
@@ -293,7 +293,7 @@ public function testGetStatsMultiline() {
293
293
* @covers \Xicrow\PhpDebug\Profiler::getLastItemName
294
294
*/
295
295
public function testGetLastItemName () {
296
- Timer::$ collection ->clear ();
296
+ Timer::getCollection () ->clear ();
297
297
298
298
$ expected = false ;
299
299
$ result = Timer::getLastItemName ();
0 commit comments