diff options
Diffstat (limited to 'tests/Monolog/Handler/SlackHandlerTest.php')
-rw-r--r-- | tests/Monolog/Handler/SlackHandlerTest.php | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/tests/Monolog/Handler/SlackHandlerTest.php b/tests/Monolog/Handler/SlackHandlerTest.php index b12b01f..e8abd15 100644 --- a/tests/Monolog/Handler/SlackHandlerTest.php +++ b/tests/Monolog/Handler/SlackHandlerTest.php @@ -1,4 +1,4 @@ -<?php +<?php declare(strict_types=1); /* * This file is part of the Monolog package. @@ -11,7 +11,7 @@ namespace Monolog\Handler; -use Monolog\TestCase; +use Monolog\Test\TestCase; use Monolog\Logger; use Monolog\Formatter\LineFormatter; use Monolog\Handler\Slack\SlackRecord; @@ -46,7 +46,7 @@ class SlackHandlerTest extends TestCase fseek($this->res, 0); $content = fread($this->res, 1024); - $this->assertRegexp('/POST \/api\/chat.postMessage HTTP\/1.1\\r\\nHost: slack.com\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); + $this->assertRegexp('{POST /api/chat.postMessage HTTP/1.1\\r\\nHost: slack.com\\r\\nContent-Type: application/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n}', $content); } public function testWriteContent() @@ -128,15 +128,14 @@ class SlackHandlerTest extends TestCase private function createHandler($token = 'myToken', $channel = 'channel1', $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeExtra = false) { - $constructorArgs = array($token, $channel, $username, $useAttachment, $iconEmoji, Logger::DEBUG, true, $useShortAttachment, $includeExtra); + $constructorArgs = [$token, $channel, $username, $useAttachment, $iconEmoji, Logger::DEBUG, true, $useShortAttachment, $includeExtra]; $this->res = fopen('php://memory', 'a'); - $this->handler = $this->getMock( - '\Monolog\Handler\SlackHandler', - array('fsockopen', 'streamSetTimeout', 'closeSocket'), - $constructorArgs - ); + $this->handler = $this->getMockBuilder('Monolog\Handler\SlackHandler') + ->setConstructorArgs($constructorArgs) + ->setMethods(['fsockopen', 'streamSetTimeout', 'closeSocket']) + ->getMock(); - $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); + $reflectionProperty = new \ReflectionProperty('Monolog\Handler\SocketHandler', 'connectionString'); $reflectionProperty->setAccessible(true); $reflectionProperty->setValue($this->handler, 'localhost:1234'); |