File tree Expand file tree Collapse file tree 7 files changed +63
-17
lines changed Expand file tree Collapse file tree 7 files changed +63
-17
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
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 Symfony \Component \Console \Helper ;
13
+
14
+ use Symfony \Component \Console \Tests ;
15
+
16
+ function time ()
17
+ {
18
+ return Tests \time ();
19
+ }
20
+
21
+ namespace Symfony \Component \Console \Tests ;
22
+
23
+ function with_clock_mock ($ enable = null )
24
+ {
25
+ static $ enabled ;
26
+
27
+ if (null === $ enable ) {
28
+ return $ enabled ;
29
+ }
30
+
31
+ $ enabled = $ enable ;
32
+ }
33
+
34
+ function time ()
35
+ {
36
+ if (!with_clock_mock ()) {
37
+ return \time ();
38
+ }
39
+
40
+ return $ _SERVER ['REQUEST_TIME ' ];
41
+ }
Original file line number Diff line number Diff line change 13
13
14
14
use Symfony \Component \Console \Helper \ProgressHelper ;
15
15
use Symfony \Component \Console \Output \StreamOutput ;
16
+ use Symfony \Component \Console \Tests ;
17
+
18
+ require_once __DIR__ .'/../ClockMock.php ' ;
16
19
17
20
class ProgressHelperTest extends \PHPUnit_Framework_TestCase
18
21
{
22
+ protected function setUp ()
23
+ {
24
+ Tests \with_clock_mock (true );
25
+ }
26
+
27
+ protected function tearDown ()
28
+ {
29
+ Tests \with_clock_mock (false );
30
+ }
31
+
19
32
public function testAdvance ()
20
33
{
21
34
$ progress = new ProgressHelper ();
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \HttpFoundation ;
13
13
14
- function time ($ asFloat = false )
14
+ function time ()
15
15
{
16
16
return Tests \time ();
17
17
}
Original file line number Diff line number Diff line change 23
23
*/
24
24
class CookieTest extends \PHPUnit_Framework_TestCase
25
25
{
26
- public function setUp ()
26
+ protected function setUp ()
27
27
{
28
28
with_clock_mock (true );
29
- parent ::setUp ();
30
29
}
31
30
32
- public function tearDown ()
31
+ protected function tearDown ()
33
32
{
34
33
with_clock_mock (false );
35
- parent ::tearDown ();
36
34
}
37
35
38
36
public function invalidNames ()
Original file line number Diff line number Diff line change 18
18
19
19
class ResponseHeaderBagTest extends \PHPUnit_Framework_TestCase
20
20
{
21
- public function setUp ()
21
+ protected function setUp ()
22
22
{
23
23
with_clock_mock (true );
24
- parent ::setUp ();
25
24
}
26
25
27
- public function tearDown ()
26
+ protected function tearDown ()
28
27
{
29
28
with_clock_mock (false );
30
- parent ::tearDown ();
31
29
}
32
30
33
31
/**
Original file line number Diff line number Diff line change @@ -24,16 +24,14 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase
24
24
{
25
25
const DELTA = 37 ;
26
26
27
- public function setUp ()
27
+ protected function setUp ()
28
28
{
29
29
with_clock_mock (true );
30
- parent ::setUp ();
31
30
}
32
31
33
- public function tearDown ()
32
+ protected function tearDown ()
34
33
{
35
34
with_clock_mock (false );
36
- parent ::tearDown ();
37
35
}
38
36
39
37
public function testGetOrigin ()
Original file line number Diff line number Diff line change @@ -24,16 +24,14 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase
24
24
{
25
25
const DELTA = 20 ;
26
26
27
- public function setUp ()
27
+ protected function setUp ()
28
28
{
29
29
with_clock_mock (true );
30
- parent ::setUp ();
31
30
}
32
31
33
- public function tearDown ()
32
+ protected function tearDown ()
34
33
{
35
34
with_clock_mock (false );
36
- parent ::tearDown ();
37
35
}
38
36
39
37
public function testStart ()
You can’t perform that action at this time.
0 commit comments