1616use Symfony \Bundle \FrameworkBundle \Tests \TestCase ;
1717use Symfony \Component \DependencyInjection \Container ;
1818use Symfony \Component \Stopwatch \Stopwatch ;
19- use Symfony \Component \Stopwatch \StopwatchEvent ;
2019use Symfony \Component \Templating \Loader \Loader ;
2120use Symfony \Component \Templating \Storage \StringStorage ;
2221use Symfony \Component \Templating \TemplateNameParserInterface ;
@@ -34,18 +33,15 @@ public function testThatRenderLogsTime()
3433 $ globalVariables = $ this ->getGlobalVariables ();
3534 $ loader = $ this ->getLoader ($ this ->getStorage ());
3635
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 ();
4637
4738 $ engine = new TimedPhpEngine ($ templateNameParser , $ container , $ loader , $ stopwatch , $ globalVariables );
4839 $ engine ->render ('index.php ' );
40+
41+ $ sections = $ stopwatch ->getSections ();
42+
43+ $ this ->assertCount (1 , $ sections );
44+ $ this ->assertCount (1 , reset ($ sections )->getEvents ());
4945 }
5046
5147 private function getTemplateNameParser (): TemplateNameParserInterface
@@ -83,14 +79,4 @@ private function getLoader($storage): Loader
8379
8480 return $ loader ;
8581 }
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- }
9682}
0 commit comments