Skip to content

Commit 3a0b6d6

Browse files
committed
clean up remaining event mocks
1 parent 224a80e commit 3a0b6d6

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

Tests/Templating/TimedPhpEngineTest.php

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1717
use Symfony\Component\DependencyInjection\Container;
1818
use Symfony\Component\Stopwatch\Stopwatch;
19-
use Symfony\Component\Stopwatch\StopwatchEvent;
2019
use Symfony\Component\Templating\Loader\Loader;
2120
use Symfony\Component\Templating\Storage\StringStorage;
2221
use 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

Comments
 (0)