1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-12 16:14:08 +02:00
This commit is contained in:
Jordi Boggiano
2015-07-14 10:25:17 +01:00
parent cf6fa57dd4
commit ca1376bd61
20 changed files with 42 additions and 41 deletions

View File

@@ -120,7 +120,7 @@ class LineFormatterTest extends \PHPUnit_Framework_TestCase
$path = str_replace('\\/', '/', json_encode(__FILE__));
$this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr($path, 1, -1).':'.(__LINE__-8).')"} []'."\n", $message);
$this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr($path, 1, -1).':'.(__LINE__ - 8).')"} []'."\n", $message);
}
public function testDefFormatWithPreviousException()
@@ -138,7 +138,7 @@ class LineFormatterTest extends \PHPUnit_Framework_TestCase
$path = str_replace('\\/', '/', json_encode(__FILE__));
$this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr($path, 1, -1).':'.(__LINE__-8).', LogicException(code: 0): Wut? at '.substr($path, 1, -1).':'.(__LINE__-12).')"} []'."\n", $message);
$this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr($path, 1, -1).':'.(__LINE__ - 8).', LogicException(code: 0): Wut? at '.substr($path, 1, -1).':'.(__LINE__ - 12).')"} []'."\n", $message);
}
public function testBatchFormat()

View File

@@ -51,10 +51,10 @@ class ChromePHPHandlerTest extends TestCase
{
$handler = new TestChromePHPHandler();
$handler->handle($this->getRecord(Logger::DEBUG));
$handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 150*1024)));
$handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 150 * 1024)));
// overflow chrome headers limit
$handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 100*1024)));
$handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 100 * 1024)));
$expected = array(
'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array(
@@ -69,7 +69,7 @@ class ChromePHPHandlerTest extends TestCase
),
array(
'test',
str_repeat('a', 150*1024),
str_repeat('a', 150 * 1024),
'unknown',
'warn',
),

View File

@@ -47,7 +47,8 @@ class HipChatHandlerTest extends TestCase
return $content;
}
public function testWriteV2() {
public function testWriteV2()
{
$this->createHandler('myToken', 'room1', 'Monolog', false, 'hipchat.foo.bar', 'v2');
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
fseek($this->res, 0);
@@ -58,7 +59,8 @@ class HipChatHandlerTest extends TestCase
return $content;
}
public function testWriteV2Notify() {
public function testWriteV2Notify()
{
$this->createHandler('myToken', 'room1', 'Monolog', true, 'hipchat.foo.bar', 'v2');
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
fseek($this->res, 0);
@@ -69,7 +71,8 @@ class HipChatHandlerTest extends TestCase
return $content;
}
public function testRoomSpaces() {
public function testRoomSpaces()
{
$this->createHandler('myToken', 'room name', 'Monolog', false, 'hipchat.foo.bar', 'v2');
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
fseek($this->res, 0);
@@ -233,7 +236,8 @@ class HipChatHandlerTest extends TestCase
$hipChatHandler = new \Monolog\Handler\HipChatHandler('token', 'room', 'SixteenCharsHere');
}
public function testCreateWithTooLongNameV2() {
public function testCreateWithTooLongNameV2()
{
// creating a handler with too long of a name but using the v2 api doesn't matter.
$hipChatHandler = new \Monolog\Handler\HipChatHandler('token', 'room', 'SixteenCharsHere', false, Logger::CRITICAL, true, true, 'test', 'api.hipchat.com', 'v2');
}

View File

@@ -114,7 +114,7 @@ class RedisHandlerTest extends TestCase
// Redis uses multi
$redis->expects($this->once())
->method('transaction')
->will($this->returnCallback(function($cb) use ($redisTransaction){
->will($this->returnCallback(function ($cb) use ($redisTransaction) {
$cb($redisTransaction);
}));

View File

@@ -28,7 +28,7 @@ class TestHandlerTest extends TestCase
$record = $this->getRecord($level, 'test'.$method);
$this->assertFalse($handler->{'has'.$method}($record), 'has'.$method);
$this->assertFalse($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains');
$this->assertFalse($handler->{'has'.$method.'ThatPasses'}(function($rec){
$this->assertFalse($handler->{'has'.$method.'ThatPasses'}(function ($rec) {
return true;
}), 'has'.$method.'ThatPasses');
$this->assertFalse($handler->{'has'.$method.'ThatMatches'}('/test\w+/'));
@@ -39,7 +39,7 @@ class TestHandlerTest extends TestCase
$this->assertTrue($handler->{'has'.$method}($record), 'has'.$method);
$this->assertTrue($handler->{'has'.$method}('test'.$method), 'has'.$method);
$this->assertTrue($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains');
$this->assertTrue($handler->{'has'.$method.'ThatPasses'}(function($rec){
$this->assertTrue($handler->{'has'.$method.'ThatPasses'}(function ($rec) {
return true;
}), 'has'.$method.'ThatPasses');
$this->assertTrue($handler->{'has'.$method.'ThatMatches'}('/test\w+/'));

View File

@@ -11,7 +11,6 @@
namespace Monolog;
class RegistryTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()