summaryrefslogtreecommitdiff
path: root/vendor/monolog/monolog/tests/Monolog/Processor
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/monolog/monolog/tests/Monolog/Processor')
-rw-r--r--vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php29
-rw-r--r--vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php123
-rw-r--r--vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php42
-rw-r--r--vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php42
-rw-r--r--vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php30
-rw-r--r--vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php43
-rw-r--r--vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php29
-rw-r--r--vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php27
-rw-r--r--vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php98
9 files changed, 0 insertions, 463 deletions
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php
deleted file mode 100644
index 5adb505d..00000000
--- a/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-use Monolog\TestCase;
-
-class GitProcessorTest extends TestCase
-{
- /**
- * @covers Monolog\Processor\GitProcessor::__invoke
- */
- public function testProcessor()
- {
- $processor = new GitProcessor();
- $record = $processor($this->getRecord());
-
- $this->assertArrayHasKey('git', $record['extra']);
- $this->assertTrue(!is_array($record['extra']['git']['branch']));
- }
-}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php
deleted file mode 100644
index 0dd411d7..00000000
--- a/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Acme;
-
-class Tester
-{
- public function test($handler, $record)
- {
- $handler->handle($record);
- }
-}
-
-function tester($handler, $record)
-{
- $handler->handle($record);
-}
-
-namespace Monolog\Processor;
-
-use Monolog\Logger;
-use Monolog\TestCase;
-use Monolog\Handler\TestHandler;
-
-class IntrospectionProcessorTest extends TestCase
-{
- public function getHandler()
- {
- $processor = new IntrospectionProcessor();
- $handler = new TestHandler();
- $handler->pushProcessor($processor);
-
- return $handler;
- }
-
- public function testProcessorFromClass()
- {
- $handler = $this->getHandler();
- $tester = new \Acme\Tester;
- $tester->test($handler, $this->getRecord());
- list($record) = $handler->getRecords();
- $this->assertEquals(__FILE__, $record['extra']['file']);
- $this->assertEquals(18, $record['extra']['line']);
- $this->assertEquals('Acme\Tester', $record['extra']['class']);
- $this->assertEquals('test', $record['extra']['function']);
- }
-
- public function testProcessorFromFunc()
- {
- $handler = $this->getHandler();
- \Acme\tester($handler, $this->getRecord());
- list($record) = $handler->getRecords();
- $this->assertEquals(__FILE__, $record['extra']['file']);
- $this->assertEquals(24, $record['extra']['line']);
- $this->assertEquals(null, $record['extra']['class']);
- $this->assertEquals('Acme\tester', $record['extra']['function']);
- }
-
- public function testLevelTooLow()
- {
- $input = array(
- 'level' => Logger::DEBUG,
- 'extra' => array(),
- );
-
- $expected = $input;
-
- $processor = new IntrospectionProcessor(Logger::CRITICAL);
- $actual = $processor($input);
-
- $this->assertEquals($expected, $actual);
- }
-
- public function testLevelEqual()
- {
- $input = array(
- 'level' => Logger::CRITICAL,
- 'extra' => array(),
- );
-
- $expected = $input;
- $expected['extra'] = array(
- 'file' => null,
- 'line' => null,
- 'class' => 'ReflectionMethod',
- 'function' => 'invokeArgs',
- );
-
- $processor = new IntrospectionProcessor(Logger::CRITICAL);
- $actual = $processor($input);
-
- $this->assertEquals($expected, $actual);
- }
-
- public function testLevelHigher()
- {
- $input = array(
- 'level' => Logger::EMERGENCY,
- 'extra' => array(),
- );
-
- $expected = $input;
- $expected['extra'] = array(
- 'file' => null,
- 'line' => null,
- 'class' => 'ReflectionMethod',
- 'function' => 'invokeArgs',
- );
-
- $processor = new IntrospectionProcessor(Logger::CRITICAL);
- $actual = $processor($input);
-
- $this->assertEquals($expected, $actual);
- }
-}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php
deleted file mode 100644
index eb666144..00000000
--- a/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-use Monolog\TestCase;
-
-class MemoryPeakUsageProcessorTest extends TestCase
-{
- /**
- * @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke
- * @covers Monolog\Processor\MemoryProcessor::formatBytes
- */
- public function testProcessor()
- {
- $processor = new MemoryPeakUsageProcessor();
- $record = $processor($this->getRecord());
- $this->assertArrayHasKey('memory_peak_usage', $record['extra']);
- $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_peak_usage']);
- }
-
- /**
- * @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke
- * @covers Monolog\Processor\MemoryProcessor::formatBytes
- */
- public function testProcessorWithoutFormatting()
- {
- $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->assertGreaterThan(0, $record['extra']['memory_peak_usage']);
- }
-}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php
deleted file mode 100644
index 4692dbfc..00000000
--- a/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-use Monolog\TestCase;
-
-class MemoryUsageProcessorTest extends TestCase
-{
- /**
- * @covers Monolog\Processor\MemoryUsageProcessor::__invoke
- * @covers Monolog\Processor\MemoryProcessor::formatBytes
- */
- public function testProcessor()
- {
- $processor = new MemoryUsageProcessor();
- $record = $processor($this->getRecord());
- $this->assertArrayHasKey('memory_usage', $record['extra']);
- $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_usage']);
- }
-
- /**
- * @covers Monolog\Processor\MemoryUsageProcessor::__invoke
- * @covers Monolog\Processor\MemoryProcessor::formatBytes
- */
- public function testProcessorWithoutFormatting()
- {
- $processor = new MemoryUsageProcessor(true, false);
- $record = $processor($this->getRecord());
- $this->assertArrayHasKey('memory_usage', $record['extra']);
- $this->assertInternalType('int', $record['extra']['memory_usage']);
- $this->assertGreaterThan(0, $record['extra']['memory_usage']);
- }
-}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php
deleted file mode 100644
index 458d2a33..00000000
--- a/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-use Monolog\TestCase;
-
-class ProcessIdProcessorTest extends TestCase
-{
- /**
- * @covers Monolog\Processor\ProcessIdProcessor::__invoke
- */
- public function testProcessor()
- {
- $processor = new ProcessIdProcessor();
- $record = $processor($this->getRecord());
- $this->assertArrayHasKey('process_id', $record['extra']);
- $this->assertInternalType('int', $record['extra']['process_id']);
- $this->assertGreaterThan(0, $record['extra']['process_id']);
- $this->assertEquals(getmypid(), $record['extra']['process_id']);
- }
-}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php
deleted file mode 100644
index 81bfbdc3..00000000
--- a/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-class PsrLogMessageProcessorTest extends \PHPUnit_Framework_TestCase
-{
- /**
- * @dataProvider getPairs
- */
- public function testReplacement($val, $expected)
- {
- $proc = new PsrLogMessageProcessor;
-
- $message = $proc(array(
- 'message' => '{foo}',
- 'context' => array('foo' => $val)
- ));
- $this->assertEquals($expected, $message['message']);
- }
-
- public function getPairs()
- {
- return array(
- array('foo', 'foo'),
- array('3', '3'),
- array(3, '3'),
- array(null, ''),
- array(true, '1'),
- array(false, ''),
- array(new \stdClass, '[object stdClass]'),
- array(array(), '[array]'),
- );
- }
-}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php
deleted file mode 100644
index 851a9dc2..00000000
--- a/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-use Monolog\TestCase;
-
-class TagProcessorTest extends TestCase
-{
- /**
- * @covers Monolog\Processor\TagProcessor::__invoke
- */
- public function testProcessor()
- {
- $tags = array(1, 2, 3);
- $processor = new TagProcessor($tags);
- $record = $processor($this->getRecord());
-
- $this->assertEquals($tags, $record['extra']['tags']);
- }
-}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php
deleted file mode 100644
index 7ced62ca..00000000
--- a/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-use Monolog\TestCase;
-
-class UidProcessorTest extends TestCase
-{
- /**
- * @covers Monolog\Processor\UidProcessor::__invoke
- */
- public function testProcessor()
- {
- $processor = new UidProcessor();
- $record = $processor($this->getRecord());
- $this->assertArrayHasKey('uid', $record['extra']);
- }
-}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php
deleted file mode 100644
index dba89412..00000000
--- a/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-use Monolog\TestCase;
-
-class WebProcessorTest extends TestCase
-{
- public function testProcessor()
- {
- $server = array(
- 'REQUEST_URI' => 'A',
- 'REMOTE_ADDR' => 'B',
- 'REQUEST_METHOD' => 'C',
- 'HTTP_REFERER' => 'D',
- 'SERVER_NAME' => 'F',
- 'UNIQUE_ID' => 'G',
- );
-
- $processor = new WebProcessor($server);
- $record = $processor($this->getRecord());
- $this->assertEquals($server['REQUEST_URI'], $record['extra']['url']);
- $this->assertEquals($server['REMOTE_ADDR'], $record['extra']['ip']);
- $this->assertEquals($server['REQUEST_METHOD'], $record['extra']['http_method']);
- $this->assertEquals($server['HTTP_REFERER'], $record['extra']['referrer']);
- $this->assertEquals($server['SERVER_NAME'], $record['extra']['server']);
- $this->assertEquals($server['UNIQUE_ID'], $record['extra']['unique_id']);
- }
-
- public function testProcessorDoNothingIfNoRequestUri()
- {
- $server = array(
- 'REMOTE_ADDR' => 'B',
- 'REQUEST_METHOD' => 'C',
- );
- $processor = new WebProcessor($server);
- $record = $processor($this->getRecord());
- $this->assertEmpty($record['extra']);
- }
-
- public function testProcessorReturnNullIfNoHttpReferer()
- {
- $server = array(
- 'REQUEST_URI' => 'A',
- 'REMOTE_ADDR' => 'B',
- 'REQUEST_METHOD' => 'C',
- 'SERVER_NAME' => 'F',
- );
- $processor = new WebProcessor($server);
- $record = $processor($this->getRecord());
- $this->assertNull($record['extra']['referrer']);
- }
-
- public function testProcessorDoesNotAddUniqueIdIfNotPresent()
- {
- $server = array(
- 'REQUEST_URI' => 'A',
- 'REMOTE_ADDR' => 'B',
- 'REQUEST_METHOD' => 'C',
- 'SERVER_NAME' => 'F',
- );
- $processor = new WebProcessor($server);
- $record = $processor($this->getRecord());
- $this->assertFalse(isset($record['extra']['unique_id']));
- }
-
- public function testProcessorAddsOnlyRequestedExtraFields()
- {
- $server = array(
- 'REQUEST_URI' => 'A',
- 'REMOTE_ADDR' => 'B',
- 'REQUEST_METHOD' => 'C',
- 'SERVER_NAME' => 'F',
- );
-
- $processor = new WebProcessor($server, array('url', 'http_method'));
- $record = $processor($this->getRecord());
-
- $this->assertSame(array('url' => 'A', 'http_method' => 'C'), $record['extra']);
- }
-
- /**
- * @expectedException UnexpectedValueException
- */
- public function testInvalidData()
- {
- new WebProcessor(new \stdClass);
- }
-}