8000 [Monolog Bridge] Remove deprecated log methods + add unit tests by FlorianLB · Pull Request #12731 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Monolog Bridge] Remove deprecated log methods + add unit tests #12731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[Monolog Bridge] add missing unit tests
  • Loading branch information
FlorianLB committed Nov 29, 2014
commit 95841e3634bab10e1fe6929f362a0293a8f52ec7
61 changes: 61 additions & 0 deletions src/Symfony/Bridge/Monolog/Tests/LoggerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bridge\Monolog\Tests;

use Symfony\Bridge\Monolog\Logger;

class LoggerTest extends \PHPUnit_Framework_TestCase
{
public function testGetLogsWithDebugHandler()
{
$expectedLogs = array('foo', 'bar');

$debugHandler = $this->getMock('Symfony\Component\HttpKernel\Log\DebugLoggerInterface');
$debugHandler
->expects($this->any())
->method('getLogs')
->will($this->returnValue($expectedLogs))
;

$logger = new Logger('foobar', array($debugHandler));
$this->assertEquals($expectedLogs, $logger->getLogs());
}

public function testGetLogsWithoutDebugHandler()
{
$handler = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface');

$logger = new Logger('foobar', array($handler));
$this->assertEquals(array(), $logger->getLogs());
}

public function testCountErrorsWithDebugHandler()
{
$debugHandler = $this->getMock('Symfony\Component\HttpKernel\Log\DebugLoggerInterface');
$debugHandler
->expects($this->any())
->method('countErrors')
->will($this->returnValue(5))
;

$logger = new Logger('foobar', array($debugHandler));
$this->assertEquals(5, $logger->countErrors());
}

public function testCountErrorsWithoutDebugHandler()
{
$handler = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface');

$logger = new Logger('foobar', array($handler));
$this->assertEquals(0, $logger->countErrors());
}
}
0