From ee350961da80d27c2ecbf87a468520e61b7dcd5c Mon Sep 17 00:00:00 2001 From: George Mponos Date: Sun, 16 Dec 2018 23:46:26 +0200 Subject: [PATCH] Remove assertInternalType that it is deprecated --- tests/Monolog/Formatter/ElasticsearchFormatterTest.php | 2 +- tests/Monolog/Formatter/MongoDBFormatterTest.php | 6 +++--- tests/Monolog/Handler/NativeMailerHandlerTest.php | 4 ++-- tests/Monolog/Handler/RavenHandlerTest.php | 2 +- tests/Monolog/Handler/Slack/SlackRecordTest.php | 4 ++-- tests/Monolog/Handler/SocketHandlerTest.php | 5 +++-- tests/Monolog/Processor/HostnameProcessorTest.php | 2 +- tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php | 2 +- tests/Monolog/Processor/MemoryUsageProcessorTest.php | 2 +- tests/Monolog/Processor/ProcessIdProcessorTest.php | 2 +- 10 files changed, 16 insertions(+), 15 deletions(-) diff --git a/tests/Monolog/Formatter/ElasticsearchFormatterTest.php b/tests/Monolog/Formatter/ElasticsearchFormatterTest.php index d68c8f11..2cd86899 100644 --- a/tests/Monolog/Formatter/ElasticsearchFormatterTest.php +++ b/tests/Monolog/Formatter/ElasticsearchFormatterTest.php @@ -45,7 +45,7 @@ class ElasticsearchFormatterTest extends \PHPUnit\Framework\TestCase // Format log message $formatter = new ElasticsearchFormatter('my_index', 'doc_type'); $doc = $formatter->format($msg); - $this->assertInternalType('array', $doc); + $this->assertIsArray($doc); // Record parameters $this->assertEquals('my_index', $doc['_index']); diff --git a/tests/Monolog/Formatter/MongoDBFormatterTest.php b/tests/Monolog/Formatter/MongoDBFormatterTest.php index 8759c016..f9494f3d 100644 --- a/tests/Monolog/Formatter/MongoDBFormatterTest.php +++ b/tests/Monolog/Formatter/MongoDBFormatterTest.php @@ -122,9 +122,9 @@ class MongoDBFormatterTest extends \PHPUnit\Framework\TestCase $this->assertCount(5, $formattedRecord['context']['except']); $this->assertEquals('exception message', $formattedRecord['context']['except']['message']); $this->assertEquals(987, $formattedRecord['context']['except']['code']); - $this->assertInternalType('string', $formattedRecord['context']['except']['file']); - $this->assertInternalType('integer', $formattedRecord['context']['except']['code']); - $this->assertInternalType('string', $formattedRecord['context']['except']['trace']); + $this->assertIsString($formattedRecord['context']['except']['file']); + $this->assertIsInt($formattedRecord['context']['except']['code']); + $this->assertIsString($formattedRecord['context']['except']['trace']); $this->assertEquals('Exception', $formattedRecord['context']['except']['class']); } diff --git a/tests/Monolog/Handler/NativeMailerHandlerTest.php b/tests/Monolog/Handler/NativeMailerHandlerTest.php index d4aef95e..9e17cd3f 100644 --- a/tests/Monolog/Handler/NativeMailerHandlerTest.php +++ b/tests/Monolog/Handler/NativeMailerHandlerTest.php @@ -87,7 +87,7 @@ class NativeMailerHandlerTest extends TestCase // non-empty batch $mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); $this->assertNotEmpty($GLOBALS['mail']); - $this->assertInternalType('array', $GLOBALS['mail']); + $this->assertIsArray($GLOBALS['mail']); $this->assertArrayHasKey('0', $GLOBALS['mail']); $params = $GLOBALS['mail'][0]; $this->assertCount(5, $params); @@ -103,7 +103,7 @@ class NativeMailerHandlerTest extends TestCase $mailer = new NativeMailerHandler('to@example.org', 'Alert: %level_name% %message%', 'from@example.org'); $mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); $this->assertNotEmpty($GLOBALS['mail']); - $this->assertInternalType('array', $GLOBALS['mail']); + $this->assertIsArray($GLOBALS['mail']); $this->assertArrayHasKey('0', $GLOBALS['mail']); $params = $GLOBALS['mail'][0]; $this->assertCount(5, $params); diff --git a/tests/Monolog/Handler/RavenHandlerTest.php b/tests/Monolog/Handler/RavenHandlerTest.php index cff5f543..491d84ac 100644 --- a/tests/Monolog/Handler/RavenHandlerTest.php +++ b/tests/Monolog/Handler/RavenHandlerTest.php @@ -138,7 +138,7 @@ class RavenHandlerTest extends TestCase // check to see if its reset $handler->handle($recordWithNoContext); - $this->assertInternalType('array', $ravenClient->context->user); + $this->assertIsArray($ravenClient->context->user); $this->assertSame('test_user_id', $ravenClient->context->user['id']); // handle with null context diff --git a/tests/Monolog/Handler/Slack/SlackRecordTest.php b/tests/Monolog/Handler/Slack/SlackRecordTest.php index eaa15571..9f23c7ce 100644 --- a/tests/Monolog/Handler/Slack/SlackRecordTest.php +++ b/tests/Monolog/Handler/Slack/SlackRecordTest.php @@ -157,7 +157,7 @@ class SlackRecordTest extends TestCase $this->assertArrayHasKey('attachments', $data); $this->assertArrayHasKey(0, $data['attachments']); - $this->assertInternalType('array', $data['attachments'][0]); + $this->assertIsArray($data['attachments'][0]); } public function testTextEqualsMessageIfNoAttachment() @@ -362,7 +362,7 @@ class SlackRecordTest extends TestCase $record = $this->getRecord(Logger::CRITICAL, 'This is a critical message.', array('exception' => new \Exception())); $slackRecord = new SlackRecord(null, null, true, null, false, true); $data = $slackRecord->getSlackData($record); - $this->assertInternalType('string', $data['attachments'][0]['fields'][1]['value']); + $this->assertIsString($data['attachments'][0]['fields'][1]['value']); } public function testExcludeExtraAndContextFields() diff --git a/tests/Monolog/Handler/SocketHandlerTest.php b/tests/Monolog/Handler/SocketHandlerTest.php index 5f76048c..a003cb7f 100644 --- a/tests/Monolog/Handler/SocketHandlerTest.php +++ b/tests/Monolog/Handler/SocketHandlerTest.php @@ -13,6 +13,7 @@ namespace Monolog\Handler; use Monolog\Test\TestCase; use Monolog\Logger; +use PHPUnit\Framework\MockObject\MockObject; /** * @author Pablo de Leon Belloc @@ -20,7 +21,7 @@ use Monolog\Logger; class SocketHandlerTest extends TestCase { /** - * @var Monolog\Handler\SocketHandler + * @var \Monolog\Handler\SocketHandler|MockObject */ private $handler; @@ -247,7 +248,7 @@ class SocketHandlerTest extends TestCase { $this->setMockHandler(); $this->writeRecord('Hello world'); - $this->assertInternalType('resource', $this->res); + $this->assertIsResource($this->res); $this->handler->close(); $this->assertFalse(is_resource($this->res), "Expected resource to be closed after closing handler"); } diff --git a/tests/Monolog/Processor/HostnameProcessorTest.php b/tests/Monolog/Processor/HostnameProcessorTest.php index 1659851b..c5745751 100644 --- a/tests/Monolog/Processor/HostnameProcessorTest.php +++ b/tests/Monolog/Processor/HostnameProcessorTest.php @@ -23,7 +23,7 @@ class HostnameProcessorTest extends TestCase $processor = new HostnameProcessor(); $record = $processor($this->getRecord()); $this->assertArrayHasKey('hostname', $record['extra']); - $this->assertInternalType('string', $record['extra']['hostname']); + $this->assertIsString($record['extra']['hostname']); $this->assertNotEmpty($record['extra']['hostname']); $this->assertEquals(gethostname(), $record['extra']['hostname']); } diff --git a/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php b/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php index cd805276..bf9cbedb 100644 --- a/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php +++ b/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php @@ -36,7 +36,7 @@ class MemoryPeakUsageProcessorTest extends TestCase $processor = new MemoryPeakUsageProcessor(true, false); $record = $processor($this->getRecord()); $this->assertArrayHasKey('memory_peak_usage', $record['extra']); - $this->assertInternalType('int', $record['extra']['memory_peak_usage']); + $this->assertIsInt($record['extra']['memory_peak_usage']); $this->assertGreaterThan(0, $record['extra']['memory_peak_usage']); } } diff --git a/tests/Monolog/Processor/MemoryUsageProcessorTest.php b/tests/Monolog/Processor/MemoryUsageProcessorTest.php index a4809cbe..d16439ba 100644 --- a/tests/Monolog/Processor/MemoryUsageProcessorTest.php +++ b/tests/Monolog/Processor/MemoryUsageProcessorTest.php @@ -36,7 +36,7 @@ class MemoryUsageProcessorTest extends TestCase $processor = new MemoryUsageProcessor(true, false); $record = $processor($this->getRecord()); $this->assertArrayHasKey('memory_usage', $record['extra']); - $this->assertInternalType('int', $record['extra']['memory_usage']); + $this->assertIsInt($record['extra']['memory_usage']); $this->assertGreaterThan(0, $record['extra']['memory_usage']); } } diff --git a/tests/Monolog/Processor/ProcessIdProcessorTest.php b/tests/Monolog/Processor/ProcessIdProcessorTest.php index ec39e8ee..0b3446fa 100644 --- a/tests/Monolog/Processor/ProcessIdProcessorTest.php +++ b/tests/Monolog/Processor/ProcessIdProcessorTest.php @@ -23,7 +23,7 @@ class ProcessIdProcessorTest extends TestCase $processor = new ProcessIdProcessor(); $record = $processor($this->getRecord()); $this->assertArrayHasKey('process_id', $record['extra']); - $this->assertInternalType('int', $record['extra']['process_id']); + $this->assertIsInt($record['extra']['process_id']); $this->assertGreaterThan(0, $record['extra']['process_id']); $this->assertEquals(getmypid(), $record['extra']['process_id']); }