17 use Symfony\Component\Console\Input\InputInterface;
18 use Symfony\Component\Console\Output\OutputInterface;
62 private $configSetCommand;
67 private $etcDirectory;
74 public function setUp()
79 $this->etcDirectory->copyFile(
'env.php',
'env.base.php');
81 $this->inputMock = $this->getMockBuilder(InputInterface::class)
82 ->getMockForAbstractClass();
83 $this->outputMock = $this->getMockBuilder(OutputInterface::class)
84 ->getMockForAbstractClass();
89 'input' => $this->inputMock,
90 'output' => $this->outputMock
97 $this->mode->enableDeveloperMode();
98 $this->enableDebugging();
99 if (file_exists($this->getDebuggerLogPath())) {
100 unlink($this->getDebuggerLogPath());
106 $this->etcDirectory->delete(
'env.php');
107 $this->etcDirectory->renameFile(
'env.base.php',
'env.php');
110 private function enableDebugging()
112 $this->inputMock = $this->getMockBuilder(InputInterface::class)
113 ->getMockForAbstractClass();
114 $this->outputMock = $this->getMockBuilder(OutputInterface::class)
115 ->getMockForAbstractClass();
116 $this->inputMock->expects($this->exactly(4))
117 ->method(
'getOption')
124 ->willReturnOnConsecutiveCalls(
130 $this->inputMock->expects($this->exactly(2))
131 ->method(
'getArgument')
133 ->willReturnOnConsecutiveCalls(
'dev/debug/debug_logging', 1);
134 $this->outputMock->expects($this->once())
136 ->with(
'<info>Value was saved in app/etc/env.php and locked.</info>');
137 $this->assertFalse((
bool)$this->configSetCommand->run($this->inputMock, $this->outputMock));
144 $this->mode->enableProductionModeMinimal();
146 $this->assertFileNotExists($this->getDebuggerLogPath());
147 $this->assertFalse((
bool)$this->appConfig->getValue(
'dev/debug/debug_logging'));
149 $this->enableDebugging();
152 $this->assertFileExists($this->getDebuggerLogPath());
159 private function getDebuggerLogPath()
161 foreach ($this->logger->getHandlers() as
$handler) {
testDebugInProductionMode()
static getObjectManager()
catch(\Exception $e) $handler