ConsoleLoggerTest.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Console\Tests\Logger;
  11. use Psr\Log\Test\LoggerInterfaceTest;
  12. use Psr\Log\LogLevel;
  13. use Symfony\Component\Console\Logger\ConsoleLogger;
  14. use Symfony\Component\Console\Tests\Fixtures\DummyOutput;
  15. use Symfony\Component\Console\Output\OutputInterface;
  16. /**
  17. * Console logger test.
  18. *
  19. * @author Kévin Dunglas <dunglas@gmail.com>
  20. */
  21. class ConsoleLoggerTest extends LoggerInterfaceTest
  22. {
  23. /**
  24. * @var DummyOutput
  25. */
  26. protected $output;
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function getLogger()
  31. {
  32. $this->output = new DummyOutput(OutputInterface::VERBOSITY_VERBOSE);
  33. return new ConsoleLogger($this->output, array(
  34. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  35. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  36. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  37. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  38. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  39. LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL,
  40. LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL,
  41. LogLevel::DEBUG => OutputInterface::VERBOSITY_NORMAL,
  42. ));
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. public function getLogs()
  48. {
  49. return $this->output->getLogs();
  50. }
  51. }