16
16
use Symfony \Bundle \FrameworkBundle \Tests \TestCase ;
17
17
use Symfony \Component \DependencyInjection \Container ;
18
18
use Symfony \Component \Stopwatch \Stopwatch ;
19
- use Symfony \Component \Stopwatch \StopwatchEvent ;
20
19
use Symfony \Component \Templating \Loader \Loader ;
21
20
use Symfony \Component \Templating \Storage \StringStorage ;
22
21
use Symfony \Component \Templating \TemplateNameParserInterface ;
@@ -34,18 +33,15 @@ public function testThatRenderLogsTime()
34
33
$ globalVariables = $ this ->getGlobalVariables ();
35
34
$ loader = $ this ->getLoader ($ this ->getStorage ());
36
35
37
- $ stopwatch = $ this ->getStopwatch ();
38
- $ stopwatchEvent = $ this ->getStopwatchEvent ();
39
-
40
- $ stopwatch ->expects ($ this ->once ())
41
- ->method ('start ' )
42
- ->with ('template.php (index.php) ' , 'template ' )
43
- ->willReturn ($ stopwatchEvent );
44
-
45
- $ stopwatchEvent ->expects ($ this ->once ())->method ('stop ' );
36
+ $ stopwatch = new Stopwatch ();
46
37
47
38
$ engine = new TimedPhpEngine ($ templateNameParser , $ container , $ loader , $ stopwatch , $ globalVariables );
48
39
$ engine ->render ('index.php ' );
40
+
41
+ $ sections = $ stopwatch ->getSections ();
42
+
43
+ $ this ->assertCount (1 , $ sections );
44
+ $ this ->assertCount (1 , reset ($ sections )->getEvents ());
49
45
}
50
46
51
47
private function getTemplateNameParser (): TemplateNameParserInterface
@@ -83,14 +79,4 @@ private function getLoader($storage): Loader
83
79
84
80
return $ loader ;
85
81
}
86
-
87
- private function getStopwatchEvent (): StopwatchEvent
88
- {
89
- return $ this ->createMock (StopwatchEvent::class);
90
- }
91
-
92
- private function getStopwatch (): Stopwatch
93
- {
94
- return $ this ->createMock (Stopwatch::class);
95
- }
96
82
}
0 commit comments