1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-07-31 18:30:15 +02:00

fix InsightOpsHandlerTest

This commit is contained in:
Sergey Zaika
2018-06-12 02:40:52 +03:00
committed by Jordi Boggiano
parent af3b4614dd
commit c1b610a676

View File

@@ -11,7 +11,7 @@
namespace Monolog\Handler; namespace Monolog\Handler;
use Monolog\TestCase; use Monolog\Test\TestCase;
use Monolog\Logger; use Monolog\Logger;
/** /**
@@ -38,7 +38,7 @@ class InsightOpsHandlerTest extends TestCase
fseek($this->resource, 0); fseek($this->resource, 0);
$content = fread($this->resource, 1024); $content = fread($this->resource, 1024);
$this->assertRegexp('/testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] test.CRITICAL: Critical write test/', $content); $this->assertRegexp('/testToken \[\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}\+00:00\] test.CRITICAL: Critical write test/', $content);
} }
public function testWriteBatchContent() public function testWriteBatchContent()
@@ -49,7 +49,7 @@ class InsightOpsHandlerTest extends TestCase
fseek($this->resource, 0); fseek($this->resource, 0);
$content = fread($this->resource, 1024); $content = fread($this->resource, 1024);
$this->assertRegexp('/(testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] .* \[\] \[\]\n){3}/', $content); $this->assertRegexp('/(testToken \[\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}\+00:00\] .* \[\] \[\]\n){3}/', $content);
} }
private function createHandler() private function createHandler()
@@ -57,11 +57,11 @@ class InsightOpsHandlerTest extends TestCase
$useSSL = extension_loaded('openssl'); $useSSL = extension_loaded('openssl');
$args = array('testToken', 'us', $useSSL, Logger::DEBUG, true); $args = array('testToken', 'us', $useSSL, Logger::DEBUG, true);
$this->resource = fopen('php://memory', 'a'); $this->resource = fopen('php://memory', 'a');
$this->handler = $this->getMock( $this->handler = $this->getMockBuilder(InsightOpsHandler::class)
'\Monolog\Handler\InsightOpsHandler', ->setMethods(array('fsockopen', 'streamSetTimeout', 'closeSocket'))
array('fsockopen', 'streamSetTimeout', 'closeSocket'), ->setConstructorArgs($args)
$args ->getMock();
);
$reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
$reflectionProperty->setAccessible(true); $reflectionProperty->setAccessible(true);