public function testIsDebug() { $inputMock = $this->getMockBuilder('Symfony\\Component\\Console\\Input\\InputInterface')->getMock(); $outputMock = $this->getMockBuilder('Symfony\\Component\\Console\\Output\\Output')->setMethods(['getVerbosity', 'doWrite'])->getMock(); $outputMock->expects($this->at(0))->method('getVerbosity')->will($this->returnValue(4)); $outputMock->expects($this->at(1))->method('getVerbosity')->will($this->returnValue(3)); $helperMock = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\HelperSet')->getMock(); $consoleIO = new ConsoleIO($inputMock, $outputMock, $helperMock); $this->assertTrue($consoleIO->isDebug()); $this->assertFalse($consoleIO->isDebug()); }
public function testIsDebug() { $isDebug = true; $this->command->setCode(function (InputInterface $input, OutputInterface $output) use(&$isDebug) { $io = new ConsoleIO($input, $output); $this->assertEquals($isDebug, $io->isDebug()); }); $this->tester->execute([], ['verbosity' => 4]); $isDebug = false; $this->tester->execute([], ['verbosity' => 3]); }
/** * Writes the staring messages. * * @param \Yosymfony\Spress\IO\ConsoleIO $io * @param string $env [description] * @param bool $drafts [description] * @param bool $safe [description] */ protected function startingMessage(ConsoleIO $io, $env, $drafts, $safe) { $io->write(['', '<info>Starting...</info>']); $io->write(sprintf('<info>Environment: %s.</info>', $env)); if ($io->isDebug()) { $io->write('<info>Debug mode enabled.</info>'); } if ($drafts) { $io->write('<info>Posts drafts enabled.</info>'); } if ($safe) { $io->write('<info>Plugins disabled.</info>'); } }
/** * Writes the staring messages. * * @param \Yosymfony\Spress\IO\ConsoleIO $io * @param string $env [description] * @param bool $drafts [description] * @param bool $safe [description] */ protected function startingMessage(ConsoleIO $io, $env, $drafts, $safe) { $io->newLine(); $io->write('<comment>Starting...</comment>'); $io->labelValue('Environment', $env); if ($io->isDebug() === true) { $io->labelValue('Debug mode', 'enabled'); } if ($drafts === true) { $io->labelValue('Draft posts', 'enabled'); } if ($safe === true) { $io->labelValue('Plugins', 'disabled'); } }