Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added `LogCall::isError` * Added `LogCall::withoutContext` * Added `LogCalls::filter` * Added `LogCalls::getErrors` * Added `LogCalls::map` * Added `LogCalls::withoutContexts`
- Loading branch information
1 parent
e09ab3a
commit 0ac12e0
Showing
5 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare( strict_types = 1 ); | ||
|
||
namespace WMDE\PsrLogTestDoubles\Tests; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Psr\Log\LogLevel; | ||
use WMDE\PsrLogTestDoubles\LogCall; | ||
|
||
/** | ||
* @covers \WMDE\PsrLogTestDoubles\LogCall | ||
* | ||
* @license GNU GPL v2+ | ||
* @author Jeroen De Dauw < jeroendedauw@gmail.com > | ||
*/ | ||
class LogCallTest extends TestCase { | ||
|
||
public function testIsNotError(): void { | ||
$this->assertFalse( ( new LogCall( LogLevel::DEBUG, '' ) )->isError() ); | ||
$this->assertFalse( ( new LogCall( LogLevel::NOTICE, '' ) )->isError() ); | ||
} | ||
|
||
public function testIsError(): void { | ||
$this->assertTrue( ( new LogCall( LogLevel::ERROR, '' ) )->isError() ); | ||
$this->assertTrue( ( new LogCall( LogLevel::EMERGENCY, '' ) )->isError() ); | ||
$this->assertTrue( ( new LogCall( LogLevel::ALERT, '' ) )->isError() ); | ||
$this->assertTrue( ( new LogCall( LogLevel::CRITICAL, '' ) )->isError() ); | ||
} | ||
|
||
public function testWithoutContextRemovesContext(): void { | ||
$call = new LogCall( LogLevel::DEBUG, 'whatever', [ 'foo' => 'bar' ] ); | ||
|
||
$this->assertEquals( | ||
new LogCall( LogLevel::DEBUG, 'whatever', [] ), | ||
$call->withoutContext() | ||
); | ||
|
||
$this->assertSame( | ||
[ 'foo' => 'bar' ], | ||
$call->getContext() | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters