5c7e19f04bb45e48ee8e86413d913e58766ebd38
[yaffs-website] / vendor / consolidation / log / tests / testLogMethods.php
1 <?php
2 namespace Consolidation\Log;
3
4 use Symfony\Component\Console\Output\BufferedOutput;
5 use Symfony\Component\Console\Output\OutputInterface;
6
7 class LogMethodTests extends \PHPUnit_Framework_TestCase
8 {
9   protected $output;
10   protected $logger;
11
12   function setup() {
13     $this->output = new BufferedOutput();
14     $this->output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
15     $this->logger = new Logger($this->output);
16     $this->logger->setLogOutputStyler(new UnstyledLogOutputStyler());
17   }
18
19   function testError() {
20     $this->logger->error('Do not enter - wrong way.');
21     $outputText = rtrim($this->output->fetch());
22     $this->assertEquals(' [error] Do not enter - wrong way.', $outputText);
23   }
24
25   function testWarning() {
26     $this->logger->warning('Steep grade.');
27     $outputText = rtrim($this->output->fetch());
28     $this->assertEquals(' [warning] Steep grade.', $outputText);
29   }
30
31   function testNotice() {
32     $this->logger->notice('No loitering.');
33     $outputText = rtrim($this->output->fetch());
34     $this->assertEquals(' [notice] No loitering.', $outputText);
35   }
36
37   function testInfo() {
38     $this->logger->info('Scenic route.');
39     $outputText = rtrim($this->output->fetch());
40     $this->assertEquals(' [info] Scenic route.', $outputText);
41   }
42
43   function testDebug() {
44     $this->logger->debug('Counter incremented.');
45     $outputText = rtrim($this->output->fetch());
46     $this->assertEquals(' [debug] Counter incremented.', $outputText);
47   }
48
49   function testSuccess() {
50     $this->logger->success('It worked!');
51     $outputText = rtrim($this->output->fetch());
52     $this->assertEquals(' [success] It worked!', $outputText);
53   }
54 }