-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improving the code coverage for log adapter tests
- Loading branch information
1 parent
100e8e2
commit e2378c7
Showing
4 changed files
with
75 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Presque package. | ||
* | ||
* (c) Justin Rainbow <justin.rainbow@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Presque\Tests; | ||
|
||
use Presque\Tests\TestCase; | ||
|
||
abstract class AbstractLogAdapterTest extends TestCase | ||
{ | ||
public function getLogLevels() | ||
{ | ||
return array( | ||
array('debug'), | ||
array('info'), | ||
array('warn'), | ||
array('err'), | ||
array('crit'), | ||
array('emerg'), | ||
array('notice'), | ||
array('alert'), | ||
); | ||
} | ||
} |
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,36 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Presque package. | ||
* | ||
* (c) Justin Rainbow <justin.rainbow@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Presque\Tests; | ||
|
||
use Presque\Tests\TestCase; | ||
use Presque\Log\ClosureLogAdapter; | ||
use Monolog\Logger; | ||
|
||
class ClosureLogAdapterTest extends AbstractLogAdapterTest | ||
{ | ||
protected $logger; | ||
protected $adapter; | ||
|
||
/** | ||
* @dataProvider getLogLevels | ||
*/ | ||
public function testLoggingMessages($level) | ||
{ | ||
$test = $this; | ||
$adapter = new ClosureLogAdapter(function ($message, $type) use (&$test, $level) { | ||
$test->assertEquals("My message", $message); | ||
$test->assertEquals($level, $type); | ||
}); | ||
|
||
$adapter->{$level}("My message"); | ||
} | ||
} |
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