1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-02 19:27:37 +02:00

Remove assertInternalType that it is deprecated

This commit is contained in:
George Mponos
2018-12-16 23:46:26 +02:00
parent 3fbaff7a63
commit ee350961da
10 changed files with 16 additions and 15 deletions

View File

@@ -45,7 +45,7 @@ class ElasticsearchFormatterTest extends \PHPUnit\Framework\TestCase
// Format log message // Format log message
$formatter = new ElasticsearchFormatter('my_index', 'doc_type'); $formatter = new ElasticsearchFormatter('my_index', 'doc_type');
$doc = $formatter->format($msg); $doc = $formatter->format($msg);
$this->assertInternalType('array', $doc); $this->assertIsArray($doc);
// Record parameters // Record parameters
$this->assertEquals('my_index', $doc['_index']); $this->assertEquals('my_index', $doc['_index']);

View File

@@ -122,9 +122,9 @@ class MongoDBFormatterTest extends \PHPUnit\Framework\TestCase
$this->assertCount(5, $formattedRecord['context']['except']); $this->assertCount(5, $formattedRecord['context']['except']);
$this->assertEquals('exception message', $formattedRecord['context']['except']['message']); $this->assertEquals('exception message', $formattedRecord['context']['except']['message']);
$this->assertEquals(987, $formattedRecord['context']['except']['code']); $this->assertEquals(987, $formattedRecord['context']['except']['code']);
$this->assertInternalType('string', $formattedRecord['context']['except']['file']); $this->assertIsString($formattedRecord['context']['except']['file']);
$this->assertInternalType('integer', $formattedRecord['context']['except']['code']); $this->assertIsInt($formattedRecord['context']['except']['code']);
$this->assertInternalType('string', $formattedRecord['context']['except']['trace']); $this->assertIsString($formattedRecord['context']['except']['trace']);
$this->assertEquals('Exception', $formattedRecord['context']['except']['class']); $this->assertEquals('Exception', $formattedRecord['context']['except']['class']);
} }

View File

@@ -87,7 +87,7 @@ class NativeMailerHandlerTest extends TestCase
// non-empty batch // non-empty batch
$mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); $mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz"));
$this->assertNotEmpty($GLOBALS['mail']); $this->assertNotEmpty($GLOBALS['mail']);
$this->assertInternalType('array', $GLOBALS['mail']); $this->assertIsArray($GLOBALS['mail']);
$this->assertArrayHasKey('0', $GLOBALS['mail']); $this->assertArrayHasKey('0', $GLOBALS['mail']);
$params = $GLOBALS['mail'][0]; $params = $GLOBALS['mail'][0];
$this->assertCount(5, $params); $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 = new NativeMailerHandler('to@example.org', 'Alert: %level_name% %message%', 'from@example.org');
$mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); $mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz"));
$this->assertNotEmpty($GLOBALS['mail']); $this->assertNotEmpty($GLOBALS['mail']);
$this->assertInternalType('array', $GLOBALS['mail']); $this->assertIsArray($GLOBALS['mail']);
$this->assertArrayHasKey('0', $GLOBALS['mail']); $this->assertArrayHasKey('0', $GLOBALS['mail']);
$params = $GLOBALS['mail'][0]; $params = $GLOBALS['mail'][0];
$this->assertCount(5, $params); $this->assertCount(5, $params);

View File

@@ -138,7 +138,7 @@ class RavenHandlerTest extends TestCase
// check to see if its reset // check to see if its reset
$handler->handle($recordWithNoContext); $handler->handle($recordWithNoContext);
$this->assertInternalType('array', $ravenClient->context->user); $this->assertIsArray($ravenClient->context->user);
$this->assertSame('test_user_id', $ravenClient->context->user['id']); $this->assertSame('test_user_id', $ravenClient->context->user['id']);
// handle with null context // handle with null context

View File

@@ -157,7 +157,7 @@ class SlackRecordTest extends TestCase
$this->assertArrayHasKey('attachments', $data); $this->assertArrayHasKey('attachments', $data);
$this->assertArrayHasKey(0, $data['attachments']); $this->assertArrayHasKey(0, $data['attachments']);
$this->assertInternalType('array', $data['attachments'][0]); $this->assertIsArray($data['attachments'][0]);
} }
public function testTextEqualsMessageIfNoAttachment() 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())); $record = $this->getRecord(Logger::CRITICAL, 'This is a critical message.', array('exception' => new \Exception()));
$slackRecord = new SlackRecord(null, null, true, null, false, true); $slackRecord = new SlackRecord(null, null, true, null, false, true);
$data = $slackRecord->getSlackData($record); $data = $slackRecord->getSlackData($record);
$this->assertInternalType('string', $data['attachments'][0]['fields'][1]['value']); $this->assertIsString($data['attachments'][0]['fields'][1]['value']);
} }
public function testExcludeExtraAndContextFields() public function testExcludeExtraAndContextFields()

View File

@@ -13,6 +13,7 @@ namespace Monolog\Handler;
use Monolog\Test\TestCase; use Monolog\Test\TestCase;
use Monolog\Logger; use Monolog\Logger;
use PHPUnit\Framework\MockObject\MockObject;
/** /**
* @author Pablo de Leon Belloc <pablolb@gmail.com> * @author Pablo de Leon Belloc <pablolb@gmail.com>
@@ -20,7 +21,7 @@ use Monolog\Logger;
class SocketHandlerTest extends TestCase class SocketHandlerTest extends TestCase
{ {
/** /**
* @var Monolog\Handler\SocketHandler * @var \Monolog\Handler\SocketHandler|MockObject
*/ */
private $handler; private $handler;
@@ -247,7 +248,7 @@ class SocketHandlerTest extends TestCase
{ {
$this->setMockHandler(); $this->setMockHandler();
$this->writeRecord('Hello world'); $this->writeRecord('Hello world');
$this->assertInternalType('resource', $this->res); $this->assertIsResource($this->res);
$this->handler->close(); $this->handler->close();
$this->assertFalse(is_resource($this->res), "Expected resource to be closed after closing handler"); $this->assertFalse(is_resource($this->res), "Expected resource to be closed after closing handler");
} }

View File

@@ -23,7 +23,7 @@ class HostnameProcessorTest extends TestCase
$processor = new HostnameProcessor(); $processor = new HostnameProcessor();
$record = $processor($this->getRecord()); $record = $processor($this->getRecord());
$this->assertArrayHasKey('hostname', $record['extra']); $this->assertArrayHasKey('hostname', $record['extra']);
$this->assertInternalType('string', $record['extra']['hostname']); $this->assertIsString($record['extra']['hostname']);
$this->assertNotEmpty($record['extra']['hostname']); $this->assertNotEmpty($record['extra']['hostname']);
$this->assertEquals(gethostname(), $record['extra']['hostname']); $this->assertEquals(gethostname(), $record['extra']['hostname']);
} }

View File

@@ -36,7 +36,7 @@ class MemoryPeakUsageProcessorTest extends TestCase
$processor = new MemoryPeakUsageProcessor(true, false); $processor = new MemoryPeakUsageProcessor(true, false);
$record = $processor($this->getRecord()); $record = $processor($this->getRecord());
$this->assertArrayHasKey('memory_peak_usage', $record['extra']); $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']); $this->assertGreaterThan(0, $record['extra']['memory_peak_usage']);
} }
} }

View File

@@ -36,7 +36,7 @@ class MemoryUsageProcessorTest extends TestCase
$processor = new MemoryUsageProcessor(true, false); $processor = new MemoryUsageProcessor(true, false);
$record = $processor($this->getRecord()); $record = $processor($this->getRecord());
$this->assertArrayHasKey('memory_usage', $record['extra']); $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']); $this->assertGreaterThan(0, $record['extra']['memory_usage']);
} }
} }

View File

@@ -23,7 +23,7 @@ class ProcessIdProcessorTest extends TestCase
$processor = new ProcessIdProcessor(); $processor = new ProcessIdProcessor();
$record = $processor($this->getRecord()); $record = $processor($this->getRecord());
$this->assertArrayHasKey('process_id', $record['extra']); $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->assertGreaterThan(0, $record['extra']['process_id']);
$this->assertEquals(getmypid(), $record['extra']['process_id']); $this->assertEquals(getmypid(), $record['extra']['process_id']);
} }