Skip to content

Commit 4610ac3

Browse files
committed
Improve test
1 parent 7491e7c commit 4610ac3

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

test/ApplicationTest.php

+3-13
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,9 @@ public function testConfigureReturnsSameContainerInstance(): void
167167

168168
public function testDebugFlagSwitchesLoggerToConsoleLogger(): void
169169
{
170-
$app = new Application('My workshop', __DIR__ . '/../app/config.php');
171-
172-
$frameworkFile = sprintf('%s/%s', sys_get_temp_dir(), uniqid($this->getName(), true));
173-
file_put_contents($frameworkFile, '<?php return []; ');
174-
175-
$rp = new \ReflectionProperty(Application::class, 'frameworkConfigLocation');
176-
$rp->setAccessible(true);
177-
$rp->setValue($app, $frameworkFile);
178-
179-
$rm = new \ReflectionMethod($app, 'getContainer');
180-
$rm->setAccessible(true);
181-
182-
$container = $rm->invoke($app, true);
170+
$configFile = $this->getTemporaryFile('config.php', '<?php return [];');
171+
$application = new Application('My workshop', $configFile);
172+
$container = $application->configure(true);
183173

184174
$container->set('phpschoolGlobalDir', $this->getTemporaryDirectory());
185175
$container->set('appName', 'my-workshop');

0 commit comments

Comments
 (0)