You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2015/05/03 14:39:57 UTC
[17/51] [partial] airavata-php-gateway git commit: removing vendor
files
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php
deleted file mode 100644
index 1687074..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php
+++ /dev/null
@@ -1,239 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Formatter\ElasticaFormatter;
-use Monolog\Formatter\NormalizerFormatter;
-use Monolog\TestCase;
-use Monolog\Logger;
-use Elastica\Client;
-use Elastica\Request;
-use Elastica\Response;
-
-class ElasticSearchHandlerTest extends TestCase
-{
- /**
- * @var Client mock
- */
- protected $client;
-
- /**
- * @var array Default handler options
- */
- protected $options = array(
- 'index' => 'my_index',
- 'type' => 'doc_type',
- );
-
- public function setUp()
- {
- // Elastica lib required
- if (!class_exists("Elastica\Client")) {
- $this->markTestSkipped("ruflin/elastica not installed");
- }
-
- // base mock Elastica Client object
- $this->client = $this->getMockBuilder('Elastica\Client')
- ->setMethods(array('addDocuments'))
- ->disableOriginalConstructor()
- ->getMock();
- }
-
- /**
- * @covers Monolog\Handler\ElasticSearchHandler::write
- * @covers Monolog\Handler\ElasticSearchHandler::handleBatch
- * @covers Monolog\Handler\ElasticSearchHandler::bulkSend
- * @covers Monolog\Handler\ElasticSearchHandler::getDefaultFormatter
- */
- public function testHandle()
- {
- // log message
- $msg = array(
- 'level' => Logger::ERROR,
- 'level_name' => 'ERROR',
- 'channel' => 'meh',
- 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass),
- 'datetime' => new \DateTime("@0"),
- 'extra' => array(),
- 'message' => 'log',
- );
-
- // format expected result
- $formatter = new ElasticaFormatter($this->options['index'], $this->options['type']);
- $expected = array($formatter->format($msg));
-
- // setup ES client mock
- $this->client->expects($this->any())
- ->method('addDocuments')
- ->with($expected);
-
- // perform tests
- $handler = new ElasticSearchHandler($this->client, $this->options);
- $handler->handle($msg);
- $handler->handleBatch(array($msg));
- }
-
- /**
- * @covers Monolog\Handler\ElasticSearchHandler::setFormatter
- */
- public function testSetFormatter()
- {
- $handler = new ElasticSearchHandler($this->client);
- $formatter = new ElasticaFormatter('index_new', 'type_new');
- $handler->setFormatter($formatter);
- $this->assertInstanceOf('Monolog\Formatter\ElasticaFormatter', $handler->getFormatter());
- $this->assertEquals('index_new', $handler->getFormatter()->getIndex());
- $this->assertEquals('type_new', $handler->getFormatter()->getType());
- }
-
- /**
- * @covers Monolog\Handler\ElasticSearchHandler::setFormatter
- * @expectedException InvalidArgumentException
- * @expectedExceptionMessage ElasticSearchHandler is only compatible with ElasticaFormatter
- */
- public function testSetFormatterInvalid()
- {
- $handler = new ElasticSearchHandler($this->client);
- $formatter = new NormalizerFormatter();
- $handler->setFormatter($formatter);
- }
-
- /**
- * @covers Monolog\Handler\ElasticSearchHandler::__construct
- * @covers Monolog\Handler\ElasticSearchHandler::getOptions
- */
- public function testOptions()
- {
- $expected = array(
- 'index' => $this->options['index'],
- 'type' => $this->options['type'],
- 'ignore_error' => false,
- );
- $handler = new ElasticSearchHandler($this->client, $this->options);
- $this->assertEquals($expected, $handler->getOptions());
- }
-
- /**
- * @covers Monolog\Handler\ElasticSearchHandler::bulkSend
- * @dataProvider providerTestConnectionErrors
- */
- public function testConnectionErrors($ignore, $expectedError)
- {
- $clientOpts = array('host' => '127.0.0.1', 'port' => 1);
- $client = new Client($clientOpts);
- $handlerOpts = array('ignore_error' => $ignore);
- $handler = new ElasticSearchHandler($client, $handlerOpts);
-
- if ($expectedError) {
- $this->setExpectedException($expectedError[0], $expectedError[1]);
- $handler->handle($this->getRecord());
- } else {
- $this->assertFalse($handler->handle($this->getRecord()));
- }
- }
-
- /**
- * @return array
- */
- public function providerTestConnectionErrors()
- {
- return array(
- array(false, array('RuntimeException', 'Error sending messages to Elasticsearch')),
- array(true, false),
- );
- }
-
- /**
- * Integration test using localhost Elastic Search server
- *
- * @covers Monolog\Handler\ElasticSearchHandler::__construct
- * @covers Monolog\Handler\ElasticSearchHandler::handleBatch
- * @covers Monolog\Handler\ElasticSearchHandler::bulkSend
- * @covers Monolog\Handler\ElasticSearchHandler::getDefaultFormatter
- */
- public function testHandleIntegration()
- {
- $msg = array(
- 'level' => Logger::ERROR,
- 'level_name' => 'ERROR',
- 'channel' => 'meh',
- 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass),
- 'datetime' => new \DateTime("@0"),
- 'extra' => array(),
- 'message' => 'log',
- );
-
- $expected = $msg;
- $expected['datetime'] = $msg['datetime']->format(\DateTime::ISO8601);
- $expected['context'] = array(
- 'class' => '[object] (stdClass: {})',
- 'foo' => 7,
- 0 => 'bar',
- );
-
- $client = new Client();
- $handler = new ElasticSearchHandler($client, $this->options);
- try {
- $handler->handleBatch(array($msg));
- } catch (\RuntimeException $e) {
- $this->markTestSkipped("Cannot connect to Elastic Search server on localhost");
- }
-
- // check document id from ES server response
- $documentId = $this->getCreatedDocId($client->getLastResponse());
- $this->assertNotEmpty($documentId, 'No elastic document id received');
-
- // retrieve document source from ES and validate
- $document = $this->getDocSourceFromElastic(
- $client,
- $this->options['index'],
- $this->options['type'],
- $documentId
- );
- $this->assertEquals($expected, $document);
-
- // remove test index from ES
- $client->request("/{$this->options['index']}", Request::DELETE);
- }
-
- /**
- * Return last created document id from ES response
- * @param Response $response Elastica Response object
- * @return string|null
- */
- protected function getCreatedDocId(Response $response)
- {
- $data = $response->getData();
- if (!empty($data['items'][0]['create']['_id'])) {
- return $data['items'][0]['create']['_id'];
- }
- }
-
- /**
- * Retrieve document by id from Elasticsearch
- * @param Client $client Elastica client
- * @param string $index
- * @param string $type
- * @param string $documentId
- * @return array
- */
- protected function getDocSourceFromElastic(Client $client, $index, $type, $documentId)
- {
- $resp = $client->request("/{$index}/{$type}/{$documentId}", Request::GET);
- $data = $resp->getData();
- if (!empty($data['_source'])) {
- return $data['_source'];
- }
-
- return array();
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php
deleted file mode 100644
index 99785cb..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\TestCase;
-use Monolog\Logger;
-use Monolog\Formatter\LineFormatter;
-
-function error_log()
-{
- $GLOBALS['error_log'][] = func_get_args();
-}
-
-class ErrorLogHandlerTest extends TestCase
-{
- protected function setUp()
- {
- $GLOBALS['error_log'] = array();
- }
-
- /**
- * @covers Monolog\Handler\ErrorLogHandler::__construct
- * @expectedException InvalidArgumentException
- * @expectedExceptionMessage The given message type "42" is not supported
- */
- public function testShouldNotAcceptAnInvalidTypeOnContructor()
- {
- new ErrorLogHandler(42);
- }
-
- /**
- * @covers Monolog\Handler\ErrorLogHandler::write
- */
- public function testShouldLogMessagesUsingErrorLogFuncion()
- {
- $type = ErrorLogHandler::OPERATING_SYSTEM;
- $handler = new ErrorLogHandler($type);
- $handler->setFormatter(new LineFormatter('%channel%.%level_name%: %message% %context% %extra%', null, true));
- $handler->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz"));
-
- $this->assertSame("test.ERROR: Foo\nBar\r\n\r\nBaz [] []", $GLOBALS['error_log'][0][0]);
- $this->assertSame($GLOBALS['error_log'][0][1], $type);
-
- $handler = new ErrorLogHandler($type, Logger::DEBUG, true, true);
- $handler->setFormatter(new LineFormatter(null, null, true));
- $handler->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz"));
-
- $this->assertStringMatchesFormat('[%s] test.ERROR: Foo', $GLOBALS['error_log'][1][0]);
- $this->assertSame($GLOBALS['error_log'][1][1], $type);
-
- $this->assertStringMatchesFormat('Bar', $GLOBALS['error_log'][2][0]);
- $this->assertSame($GLOBALS['error_log'][2][1], $type);
-
- $this->assertStringMatchesFormat('Baz [] []', $GLOBALS['error_log'][3][0]);
- $this->assertSame($GLOBALS['error_log'][3][1], $type);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php
deleted file mode 100644
index 31b7686..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-use Monolog\TestCase;
-
-class FilterHandlerTest extends TestCase
-{
- /**
- * @covers Monolog\Handler\FilterHandler::isHandling
- */
- public function testIsHandling()
- {
- $test = new TestHandler();
- $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE);
- $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG)));
- $this->assertTrue($handler->isHandling($this->getRecord(Logger::INFO)));
- $this->assertTrue($handler->isHandling($this->getRecord(Logger::NOTICE)));
- $this->assertFalse($handler->isHandling($this->getRecord(Logger::WARNING)));
- $this->assertFalse($handler->isHandling($this->getRecord(Logger::ERROR)));
- $this->assertFalse($handler->isHandling($this->getRecord(Logger::CRITICAL)));
- $this->assertFalse($handler->isHandling($this->getRecord(Logger::ALERT)));
- $this->assertFalse($handler->isHandling($this->getRecord(Logger::EMERGENCY)));
- }
-
- /**
- * @covers Monolog\Handler\FilterHandler::handle
- * @covers Monolog\Handler\FilterHandler::setAcceptedLevels
- * @covers Monolog\Handler\FilterHandler::isHandling
- */
- public function testHandleProcessOnlyNeededLevels()
- {
- $test = new TestHandler();
- $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE);
-
- $handler->handle($this->getRecord(Logger::DEBUG));
- $this->assertFalse($test->hasDebugRecords());
-
- $handler->handle($this->getRecord(Logger::INFO));
- $this->assertTrue($test->hasInfoRecords());
- $handler->handle($this->getRecord(Logger::NOTICE));
- $this->assertTrue($test->hasNoticeRecords());
-
- $handler->handle($this->getRecord(Logger::WARNING));
- $this->assertFalse($test->hasWarningRecords());
- $handler->handle($this->getRecord(Logger::ERROR));
- $this->assertFalse($test->hasErrorRecords());
- $handler->handle($this->getRecord(Logger::CRITICAL));
- $this->assertFalse($test->hasCriticalRecords());
- $handler->handle($this->getRecord(Logger::ALERT));
- $this->assertFalse($test->hasAlertRecords());
- $handler->handle($this->getRecord(Logger::EMERGENCY));
- $this->assertFalse($test->hasEmergencyRecords());
-
- $test = new TestHandler();
- $handler = new FilterHandler($test, array(Logger::INFO, Logger::ERROR));
-
- $handler->handle($this->getRecord(Logger::DEBUG));
- $this->assertFalse($test->hasDebugRecords());
- $handler->handle($this->getRecord(Logger::INFO));
- $this->assertTrue($test->hasInfoRecords());
- $handler->handle($this->getRecord(Logger::NOTICE));
- $this->assertFalse($test->hasNoticeRecords());
- $handler->handle($this->getRecord(Logger::ERROR));
- $this->assertTrue($test->hasErrorRecords());
- $handler->handle($this->getRecord(Logger::CRITICAL));
- $this->assertFalse($test->hasCriticalRecords());
- }
-
- /**
- * @covers Monolog\Handler\FilterHandler::setAcceptedLevels
- * @covers Monolog\Handler\FilterHandler::getAcceptedLevels
- */
- public function testAcceptedLevelApi()
- {
- $test = new TestHandler();
- $handler = new FilterHandler($test);
-
- $levels = array(Logger::INFO, Logger::ERROR);
- $handler->setAcceptedLevels($levels);
- $this->assertSame($levels, $handler->getAcceptedLevels());
-
- $handler->setAcceptedLevels(array('info', 'error'));
- $this->assertSame($levels, $handler->getAcceptedLevels());
-
- $levels = array(Logger::CRITICAL, Logger::ALERT, Logger::EMERGENCY);
- $handler->setAcceptedLevels(Logger::CRITICAL, Logger::EMERGENCY);
- $this->assertSame($levels, $handler->getAcceptedLevels());
-
- $handler->setAcceptedLevels('critical', 'emergency');
- $this->assertSame($levels, $handler->getAcceptedLevels());
- }
-
- /**
- * @covers Monolog\Handler\FilterHandler::handle
- */
- public function testHandleUsesProcessors()
- {
- $test = new TestHandler();
- $handler = new FilterHandler($test, Logger::DEBUG, Logger::EMERGENCY);
- $handler->pushProcessor(
- function ($record) {
- $record['extra']['foo'] = true;
-
- return $record;
- }
- );
- $handler->handle($this->getRecord(Logger::WARNING));
- $this->assertTrue($test->hasWarningRecords());
- $records = $test->getRecords();
- $this->assertTrue($records[0]['extra']['foo']);
- }
-
- /**
- * @covers Monolog\Handler\FilterHandler::handle
- */
- public function testHandleRespectsBubble()
- {
- $test = new TestHandler();
-
- $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE, false);
- $this->assertTrue($handler->handle($this->getRecord(Logger::INFO)));
- $this->assertFalse($handler->handle($this->getRecord(Logger::WARNING)));
-
- $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE, true);
- $this->assertFalse($handler->handle($this->getRecord(Logger::INFO)));
- $this->assertFalse($handler->handle($this->getRecord(Logger::WARNING)));
- }
-
- /**
- * @covers Monolog\Handler\FilterHandler::handle
- */
- public function testHandleWithCallback()
- {
- $test = new TestHandler();
- $handler = new FilterHandler(
- function ($record, $handler) use ($test) {
- return $test;
- }, Logger::INFO, Logger::NOTICE, false
- );
- $handler->handle($this->getRecord(Logger::DEBUG));
- $handler->handle($this->getRecord(Logger::INFO));
- $this->assertFalse($test->hasDebugRecords());
- $this->assertTrue($test->hasInfoRecords());
- }
-
- /**
- * @covers Monolog\Handler\FilterHandler::handle
- * @expectedException \RuntimeException
- */
- public function testHandleWithBadCallbackThrowsException()
- {
- $handler = new FilterHandler(
- function ($record, $handler) {
- return 'foo';
- }
- );
- $handler->handle($this->getRecord(Logger::WARNING));
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php
deleted file mode 100644
index a3d350d..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php
+++ /dev/null
@@ -1,240 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\TestCase;
-use Monolog\Logger;
-use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
-use Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy;
-
-class FingersCrossedHandlerTest extends TestCase
-{
- /**
- * @covers Monolog\Handler\FingersCrossedHandler::__construct
- * @covers Monolog\Handler\FingersCrossedHandler::handle
- */
- public function testHandleBuffers()
- {
- $test = new TestHandler();
- $handler = new FingersCrossedHandler($test);
- $handler->handle($this->getRecord(Logger::DEBUG));
- $handler->handle($this->getRecord(Logger::INFO));
- $this->assertFalse($test->hasDebugRecords());
- $this->assertFalse($test->hasInfoRecords());
- $handler->handle($this->getRecord(Logger::WARNING));
- $handler->close();
- $this->assertTrue($test->hasInfoRecords());
- $this->assertTrue(count($test->getRecords()) === 3);
- }
-
- /**
- * @covers Monolog\Handler\FingersCrossedHandler::handle
- */
- public function testHandleStopsBufferingAfterTrigger()
- {
- $test = new TestHandler();
- $handler = new FingersCrossedHandler($test);
- $handler->handle($this->getRecord(Logger::WARNING));
- $handler->handle($this->getRecord(Logger::DEBUG));
- $handler->close();
- $this->assertTrue($test->hasWarningRecords());
- $this->assertTrue($test->hasDebugRecords());
- }
-
- /**
- * @covers Monolog\Handler\FingersCrossedHandler::handle
- * @covers Monolog\Handler\FingersCrossedHandler::reset
- */
- public function testHandleRestartBufferingAfterReset()
- {
- $test = new TestHandler();
- $handler = new FingersCrossedHandler($test);
- $handler->handle($this->getRecord(Logger::WARNING));
- $handler->handle($this->getRecord(Logger::DEBUG));
- $handler->reset();
- $handler->handle($this->getRecord(Logger::INFO));
- $handler->close();
- $this->assertTrue($test->hasWarningRecords());
- $this->assertTrue($test->hasDebugRecords());
- $this->assertFalse($test->hasInfoRecords());
- }
-
- /**
- * @covers Monolog\Handler\FingersCrossedHandler::handle
- */
- public function testHandleRestartBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled()
- {
- $test = new TestHandler();
- $handler = new FingersCrossedHandler($test, Logger::WARNING, 0, false, false);
- $handler->handle($this->getRecord(Logger::DEBUG));
- $handler->handle($this->getRecord(Logger::WARNING));
- $handler->handle($this->getRecord(Logger::INFO));
- $handler->close();
- $this->assertTrue($test->hasWarningRecords());
- $this->assertTrue($test->hasDebugRecords());
- $this->assertFalse($test->hasInfoRecords());
- }
-
- /**
- * @covers Monolog\Handler\FingersCrossedHandler::handle
- */
- public function testHandleBufferLimit()
- {
- $test = new TestHandler();
- $handler = new FingersCrossedHandler($test, Logger::WARNING, 2);
- $handler->handle($this->getRecord(Logger::DEBUG));
- $handler->handle($this->getRecord(Logger::DEBUG));
- $handler->handle($this->getRecord(Logger::INFO));
- $handler->handle($this->getRecord(Logger::WARNING));
- $this->assertTrue($test->hasWarningRecords());
- $this->assertTrue($test->hasInfoRecords());
- $this->assertFalse($test->hasDebugRecords());
- }
-
- /**
- * @covers Monolog\Handler\FingersCrossedHandler::handle
- */
- public function testHandleWithCallback()
- {
- $test = new TestHandler();
- $handler = new FingersCrossedHandler(function ($record, $handler) use ($test) {
- return $test;
- });
- $handler->handle($this->getRecord(Logger::DEBUG));
- $handler->handle($this->getRecord(Logger::INFO));
- $this->assertFalse($test->hasDebugRecords());
- $this->assertFalse($test->hasInfoRecords());
- $handler->handle($this->getRecord(Logger::WARNING));
- $this->assertTrue($test->hasInfoRecords());
- $this->assertTrue(count($test->getRecords()) === 3);
- }
-
- /**
- * @covers Monolog\Handler\FingersCrossedHandler::handle
- * @expectedException RuntimeException
- */
- public function testHandleWithBadCallbackThrowsException()
- {
- $handler = new FingersCrossedHandler(function ($record, $handler) {
- return 'foo';
- });
- $handler->handle($this->getRecord(Logger::WARNING));
- }
-
- /**
- * @covers Monolog\Handler\FingersCrossedHandler::isHandling
- */
- public function testIsHandlingAlways()
- {
- $test = new TestHandler();
- $handler = new FingersCrossedHandler($test, Logger::ERROR);
- $this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG)));
- }
-
- /**
- * @covers Monolog\Handler\FingersCrossedHandler::__construct
- * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::__construct
- * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::isHandlerActivated
- */
- public function testErrorLevelActivationStrategy()
- {
- $test = new TestHandler();
- $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING));
- $handler->handle($this->getRecord(Logger::DEBUG));
- $this->assertFalse($test->hasDebugRecords());
- $handler->handle($this->getRecord(Logger::WARNING));
- $this->assertTrue($test->hasDebugRecords());
- $this->assertTrue($test->hasWarningRecords());
- }
-
- /**
- * @covers Monolog\Handler\FingersCrossedHandler::__construct
- * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::__construct
- * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::isHandlerActivated
- */
- public function testErrorLevelActivationStrategyWithPsrLevel()
- {
- $test = new TestHandler();
- $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('warning'));
- $handler->handle($this->getRecord(Logger::DEBUG));
- $this->assertFalse($test->hasDebugRecords());
- $handler->handle($this->getRecord(Logger::WARNING));
- $this->assertTrue($test->hasDebugRecords());
- $this->assertTrue($test->hasWarningRecords());
- }
-
- /**
- * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct
- * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated
- */
- public function testChannelLevelActivationStrategy()
- {
- $test = new TestHandler();
- $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy(Logger::ERROR, array('othertest' => Logger::DEBUG)));
- $handler->handle($this->getRecord(Logger::WARNING));
- $this->assertFalse($test->hasWarningRecords());
- $record = $this->getRecord(Logger::DEBUG);
- $record['channel'] = 'othertest';
- $handler->handle($record);
- $this->assertTrue($test->hasDebugRecords());
- $this->assertTrue($test->hasWarningRecords());
- }
-
- /**
- * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct
- * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated
- */
- public function testChannelLevelActivationStrategyWithPsrLevels()
- {
- $test = new TestHandler();
- $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy('error', array('othertest' => 'debug')));
- $handler->handle($this->getRecord(Logger::WARNING));
- $this->assertFalse($test->hasWarningRecords());
- $record = $this->getRecord(Logger::DEBUG);
- $record['channel'] = 'othertest';
- $handler->handle($record);
- $this->assertTrue($test->hasDebugRecords());
- $this->assertTrue($test->hasWarningRecords());
- }
-
- /**
- * @covers Monolog\Handler\FingersCrossedHandler::handle
- */
- public function testHandleUsesProcessors()
- {
- $test = new TestHandler();
- $handler = new FingersCrossedHandler($test, Logger::INFO);
- $handler->pushProcessor(function ($record) {
- $record['extra']['foo'] = true;
-
- return $record;
- });
- $handler->handle($this->getRecord(Logger::WARNING));
- $this->assertTrue($test->hasWarningRecords());
- $records = $test->getRecords();
- $this->assertTrue($records[0]['extra']['foo']);
- }
-
- /**
- * @covers Monolog\Handler\FingersCrossedHandler::close
- */
- public function testPassthruOnClose()
- {
- $test = new TestHandler();
- $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, Logger::INFO);
- $handler->handle($this->getRecord(Logger::DEBUG));
- $handler->handle($this->getRecord(Logger::INFO));
- $handler->close();
- $this->assertFalse($test->hasDebugRecords());
- $this->assertTrue($test->hasInfoRecords());
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php
deleted file mode 100644
index 0eb10a6..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\TestCase;
-use Monolog\Logger;
-
-/**
- * @covers Monolog\Handler\FirePHPHandler
- */
-class FirePHPHandlerTest extends TestCase
-{
- public function setUp()
- {
- TestFirePHPHandler::reset();
- $_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; FirePHP/1.0';
- }
-
- public function testHeaders()
- {
- $handler = new TestFirePHPHandler;
- $handler->setFormatter($this->getIdentityFormatter());
- $handler->handle($this->getRecord(Logger::DEBUG));
- $handler->handle($this->getRecord(Logger::WARNING));
-
- $expected = array(
- 'X-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2',
- 'X-Wf-1-Structure-1' => 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1',
- 'X-Wf-1-Plugin-1' => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3',
- 'X-Wf-1-1-1-1' => 'test',
- 'X-Wf-1-1-1-2' => 'test',
- );
-
- $this->assertEquals($expected, $handler->getHeaders());
- }
-
- public function testConcurrentHandlers()
- {
- $handler = new TestFirePHPHandler;
- $handler->setFormatter($this->getIdentityFormatter());
- $handler->handle($this->getRecord(Logger::DEBUG));
- $handler->handle($this->getRecord(Logger::WARNING));
-
- $handler2 = new TestFirePHPHandler;
- $handler2->setFormatter($this->getIdentityFormatter());
- $handler2->handle($this->getRecord(Logger::DEBUG));
- $handler2->handle($this->getRecord(Logger::WARNING));
-
- $expected = array(
- 'X-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2',
- 'X-Wf-1-Structure-1' => 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1',
- 'X-Wf-1-Plugin-1' => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3',
- 'X-Wf-1-1-1-1' => 'test',
- 'X-Wf-1-1-1-2' => 'test',
- );
-
- $expected2 = array(
- 'X-Wf-1-1-1-3' => 'test',
- 'X-Wf-1-1-1-4' => 'test',
- );
-
- $this->assertEquals($expected, $handler->getHeaders());
- $this->assertEquals($expected2, $handler2->getHeaders());
- }
-}
-
-class TestFirePHPHandler extends FirePHPHandler
-{
- protected $headers = array();
-
- public static function reset()
- {
- self::$initialized = false;
- self::$sendHeaders = true;
- self::$messageIndex = 1;
- }
-
- protected function sendHeader($header, $content)
- {
- $this->headers[$header] = $content;
- }
-
- public function getHeaders()
- {
- return $this->headers;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/Fixtures/.gitkeep
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/Fixtures/.gitkeep b/vendor/monolog/monolog/tests/Monolog/Handler/Fixtures/.gitkeep
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php
deleted file mode 100644
index 91cdd31..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Formatter\LineFormatter;
-use Monolog\Logger;
-use Monolog\TestCase;
-
-/**
- * @coversDefaultClass \Monolog\Handler\FleepHookHandler
- */
-class FleepHookHandlerTest extends TestCase
-{
- /**
- * Default token to use in tests
- */
- const TOKEN = '123abc';
-
- /**
- * @var FleepHookHandler
- */
- private $handler;
-
- public function setUp()
- {
- parent::setUp();
-
- if (!extension_loaded('openssl')) {
- $this->markTestSkipped('This test requires openssl extension to run');
- }
-
- // Create instances of the handler and logger for convenience
- $this->handler = new FleepHookHandler(self::TOKEN);
- }
-
- /**
- * @covers ::__construct
- */
- public function testConstructorSetsExpectedDefaults()
- {
- $this->assertEquals(Logger::DEBUG, $this->handler->getLevel());
- $this->assertEquals(true, $this->handler->getBubble());
- }
-
- /**
- * @covers ::getDefaultFormatter
- */
- public function testHandlerUsesLineFormatterWhichIgnoresEmptyArrays()
- {
- $record = array(
- 'message' => 'msg',
- 'context' => array(),
- 'level' => Logger::DEBUG,
- 'level_name' => Logger::getLevelName(Logger::DEBUG),
- 'channel' => 'channel',
- 'datetime' => new \DateTime(),
- 'extra' => array(),
- );
-
- $expectedFormatter = new LineFormatter(null, null, true, true);
- $expected = $expectedFormatter->format($record);
-
- $handlerFormatter = $this->handler->getFormatter();
- $actual = $handlerFormatter->format($record);
-
- $this->assertEquals($expected, $actual, 'Empty context and extra arrays should not be rendered');
- }
-
- /**
- * @covers ::__construct
- */
- public function testConnectionStringisConstructedCorrectly()
- {
- $this->assertEquals('ssl://' . FleepHookHandler::FLEEP_HOST . ':443', $this->handler->getConnectionString());
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php
deleted file mode 100644
index 4b120d5..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Formatter\FlowdockFormatter;
-use Monolog\TestCase;
-use Monolog\Logger;
-
-/**
- * @author Dominik Liebler <li...@gmail.com>
- * @see https://www.hipchat.com/docs/api
- */
-class FlowdockHandlerTest extends TestCase
-{
- /**
- * @var resource
- */
- private $res;
-
- /**
- * @var FlowdockHandler
- */
- private $handler;
-
- public function setUp()
- {
- if (!extension_loaded('openssl')) {
- $this->markTestSkipped('This test requires openssl to run');
- }
- }
-
- public function testWriteHeader()
- {
- $this->createHandler();
- $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/POST \/v1\/messages\/team_inbox\/.* HTTP\/1.1\\r\\nHost: api.flowdock.com\\r\\nContent-Type: application\/json\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
-
- return $content;
- }
-
- /**
- * @depends testWriteHeader
- */
- public function testWriteContent($content)
- {
- $this->assertRegexp('/"source":"test_source"/', $content);
- $this->assertRegexp('/"from_address":"source@test\.com"/', $content);
- }
-
- private function createHandler($token = 'myToken')
- {
- $constructorArgs = array($token, Logger::DEBUG);
- $this->res = fopen('php://memory', 'a');
- $this->handler = $this->getMock(
- '\Monolog\Handler\FlowdockHandler',
- array('fsockopen', 'streamSetTimeout', 'closeSocket'),
- $constructorArgs
- );
-
- $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
- $reflectionProperty->setAccessible(true);
- $reflectionProperty->setValue($this->handler, 'localhost:1234');
-
- $this->handler->expects($this->any())
- ->method('fsockopen')
- ->will($this->returnValue($this->res));
- $this->handler->expects($this->any())
- ->method('streamSetTimeout')
- ->will($this->returnValue(true));
- $this->handler->expects($this->any())
- ->method('closeSocket')
- ->will($this->returnValue(true));
-
- $this->handler->setFormatter(new FlowdockFormatter('test_source', 'source@test.com'));
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php
deleted file mode 100644
index 9d007b1..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Gelf\Message;
-use Monolog\TestCase;
-use Monolog\Logger;
-use Monolog\Formatter\GelfMessageFormatter;
-
-class GelfHandlerLegacyTest extends TestCase
-{
- public function setUp()
- {
- if (!class_exists('Gelf\MessagePublisher') || !class_exists('Gelf\Message')) {
- $this->markTestSkipped("mlehner/gelf-php not installed");
- }
-
- require_once __DIR__ . '/GelfMockMessagePublisher.php';
- }
-
- /**
- * @covers Monolog\Handler\GelfHandler::__construct
- */
- public function testConstruct()
- {
- $handler = new GelfHandler($this->getMessagePublisher());
- $this->assertInstanceOf('Monolog\Handler\GelfHandler', $handler);
- }
-
- protected function getHandler($messagePublisher)
- {
- $handler = new GelfHandler($messagePublisher);
-
- return $handler;
- }
-
- protected function getMessagePublisher()
- {
- return new GelfMockMessagePublisher('localhost');
- }
-
- public function testDebug()
- {
- $messagePublisher = $this->getMessagePublisher();
- $handler = $this->getHandler($messagePublisher);
-
- $record = $this->getRecord(Logger::DEBUG, "A test debug message");
- $handler->handle($record);
-
- $this->assertEquals(7, $messagePublisher->lastMessage->getLevel());
- $this->assertEquals('test', $messagePublisher->lastMessage->getFacility());
- $this->assertEquals($record['message'], $messagePublisher->lastMessage->getShortMessage());
- $this->assertEquals(null, $messagePublisher->lastMessage->getFullMessage());
- }
-
- public function testWarning()
- {
- $messagePublisher = $this->getMessagePublisher();
- $handler = $this->getHandler($messagePublisher);
-
- $record = $this->getRecord(Logger::WARNING, "A test warning message");
- $handler->handle($record);
-
- $this->assertEquals(4, $messagePublisher->lastMessage->getLevel());
- $this->assertEquals('test', $messagePublisher->lastMessage->getFacility());
- $this->assertEquals($record['message'], $messagePublisher->lastMessage->getShortMessage());
- $this->assertEquals(null, $messagePublisher->lastMessage->getFullMessage());
- }
-
- public function testInjectedGelfMessageFormatter()
- {
- $messagePublisher = $this->getMessagePublisher();
- $handler = $this->getHandler($messagePublisher);
-
- $handler->setFormatter(new GelfMessageFormatter('mysystem', 'EXT', 'CTX'));
-
- $record = $this->getRecord(Logger::WARNING, "A test warning message");
- $record['extra']['blarg'] = 'yep';
- $record['context']['from'] = 'logger';
- $handler->handle($record);
-
- $this->assertEquals('mysystem', $messagePublisher->lastMessage->getHost());
- $this->assertArrayHasKey('_EXTblarg', $messagePublisher->lastMessage->toArray());
- $this->assertArrayHasKey('_CTXfrom', $messagePublisher->lastMessage->toArray());
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php
deleted file mode 100644
index 8cdd64f..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php
+++ /dev/null
@@ -1,117 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Gelf\Message;
-use Monolog\TestCase;
-use Monolog\Logger;
-use Monolog\Formatter\GelfMessageFormatter;
-
-class GelfHandlerTest extends TestCase
-{
- public function setUp()
- {
- if (!class_exists('Gelf\Publisher') || !class_exists('Gelf\Message')) {
- $this->markTestSkipped("graylog2/gelf-php not installed");
- }
- }
-
- /**
- * @covers Monolog\Handler\GelfHandler::__construct
- */
- public function testConstruct()
- {
- $handler = new GelfHandler($this->getMessagePublisher());
- $this->assertInstanceOf('Monolog\Handler\GelfHandler', $handler);
- }
-
- protected function getHandler($messagePublisher)
- {
- $handler = new GelfHandler($messagePublisher);
-
- return $handler;
- }
-
- protected function getMessagePublisher()
- {
- return $this->getMock('Gelf\Publisher', array('publish'), array(), '', false);
- }
-
- public function testDebug()
- {
- $record = $this->getRecord(Logger::DEBUG, "A test debug message");
- $expectedMessage = new Message();
- $expectedMessage
- ->setLevel(7)
- ->setFacility("test")
- ->setShortMessage($record['message'])
- ->setTimestamp($record['datetime'])
- ;
-
- $messagePublisher = $this->getMessagePublisher();
- $messagePublisher->expects($this->once())
- ->method('publish')
- ->with($expectedMessage);
-
- $handler = $this->getHandler($messagePublisher);
-
- $handler->handle($record);
- }
-
- public function testWarning()
- {
- $record = $this->getRecord(Logger::WARNING, "A test warning message");
- $expectedMessage = new Message();
- $expectedMessage
- ->setLevel(4)
- ->setFacility("test")
- ->setShortMessage($record['message'])
- ->setTimestamp($record['datetime'])
- ;
-
- $messagePublisher = $this->getMessagePublisher();
- $messagePublisher->expects($this->once())
- ->method('publish')
- ->with($expectedMessage);
-
- $handler = $this->getHandler($messagePublisher);
-
- $handler->handle($record);
- }
-
- public function testInjectedGelfMessageFormatter()
- {
- $record = $this->getRecord(Logger::WARNING, "A test warning message");
- $record['extra']['blarg'] = 'yep';
- $record['context']['from'] = 'logger';
-
- $expectedMessage = new Message();
- $expectedMessage
- ->setLevel(4)
- ->setFacility("test")
- ->setHost("mysystem")
- ->setShortMessage($record['message'])
- ->setTimestamp($record['datetime'])
- ->setAdditional("EXTblarg", 'yep')
- ->setAdditional("CTXfrom", 'logger')
- ;
-
- $messagePublisher = $this->getMessagePublisher();
- $messagePublisher->expects($this->once())
- ->method('publish')
- ->with($expectedMessage);
-
- $handler = $this->getHandler($messagePublisher);
- $handler->setFormatter(new GelfMessageFormatter('mysystem', 'EXT', 'CTX'));
- $handler->handle($record);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php b/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php
deleted file mode 100644
index 873d92f..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Gelf\MessagePublisher;
-use Gelf\Message;
-
-class GelfMockMessagePublisher extends MessagePublisher
-{
- public function publish(Message $message)
- {
- $this->lastMessage = $message;
- }
-
- public $lastMessage = null;
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php
deleted file mode 100644
index c6298a6..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\TestCase;
-use Monolog\Logger;
-
-class GroupHandlerTest extends TestCase
-{
- /**
- * @covers Monolog\Handler\GroupHandler::__construct
- * @expectedException InvalidArgumentException
- */
- public function testConstructorOnlyTakesHandler()
- {
- new GroupHandler(array(new TestHandler(), "foo"));
- }
-
- /**
- * @covers Monolog\Handler\GroupHandler::__construct
- * @covers Monolog\Handler\GroupHandler::handle
- */
- public function testHandle()
- {
- $testHandlers = array(new TestHandler(), new TestHandler());
- $handler = new GroupHandler($testHandlers);
- $handler->handle($this->getRecord(Logger::DEBUG));
- $handler->handle($this->getRecord(Logger::INFO));
- foreach ($testHandlers as $test) {
- $this->assertTrue($test->hasDebugRecords());
- $this->assertTrue($test->hasInfoRecords());
- $this->assertTrue(count($test->getRecords()) === 2);
- }
- }
-
- /**
- * @covers Monolog\Handler\GroupHandler::handleBatch
- */
- public function testHandleBatch()
- {
- $testHandlers = array(new TestHandler(), new TestHandler());
- $handler = new GroupHandler($testHandlers);
- $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO)));
- foreach ($testHandlers as $test) {
- $this->assertTrue($test->hasDebugRecords());
- $this->assertTrue($test->hasInfoRecords());
- $this->assertTrue(count($test->getRecords()) === 2);
- }
- }
-
- /**
- * @covers Monolog\Handler\GroupHandler::isHandling
- */
- public function testIsHandling()
- {
- $testHandlers = array(new TestHandler(Logger::ERROR), new TestHandler(Logger::WARNING));
- $handler = new GroupHandler($testHandlers);
- $this->assertTrue($handler->isHandling($this->getRecord(Logger::ERROR)));
- $this->assertTrue($handler->isHandling($this->getRecord(Logger::WARNING)));
- $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG)));
- }
-
- /**
- * @covers Monolog\Handler\GroupHandler::handle
- */
- public function testHandleUsesProcessors()
- {
- $test = new TestHandler();
- $handler = new GroupHandler(array($test));
- $handler->pushProcessor(function ($record) {
- $record['extra']['foo'] = true;
-
- return $record;
- });
- $handler->handle($this->getRecord(Logger::WARNING));
- $this->assertTrue($test->hasWarningRecords());
- $records = $test->getRecords();
- $this->assertTrue($records[0]['extra']['foo']);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php
deleted file mode 100644
index 49f1dfb..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php
+++ /dev/null
@@ -1,178 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\TestCase;
-use Monolog\Logger;
-
-/**
- * @author Rafael Dohms <ra...@doh.ms>
- * @see https://www.hipchat.com/docs/api
- */
-class HipChatHandlerTest extends TestCase
-{
- private $res;
- private $handler;
-
- public function testWriteHeader()
- {
- $this->createHandler();
- $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/POST \/v1\/rooms\/message\?format=json&auth_token=.* HTTP\/1.1\\r\\nHost: api.hipchat.com\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
-
- return $content;
- }
-
- public function testWriteCustomHostHeader()
- {
- $this->createHandler('myToken', 'room1', 'Monolog', false, 'hipchat.foo.bar');
- $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/POST \/v1\/rooms\/message\?format=json&auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
-
- return $content;
- }
-
- /**
- * @depends testWriteHeader
- */
- public function testWriteContent($content)
- {
- $this->assertRegexp('/from=Monolog&room_id=room1¬ify=0&message=test1&message_format=text&color=red$/', $content);
- }
-
- public function testWriteWithComplexMessage()
- {
- $this->createHandler();
- $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Backup of database "example" finished in 16 minutes.'));
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content);
- }
-
- /**
- * @dataProvider provideLevelColors
- */
- public function testWriteWithErrorLevelsAndColors($level, $expectedColor)
- {
- $this->createHandler();
- $this->handler->handle($this->getRecord($level, 'Backup of database "example" finished in 16 minutes.'));
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/color='.$expectedColor.'/', $content);
- }
-
- public function provideLevelColors()
- {
- return array(
- array(Logger::DEBUG, 'gray'),
- array(Logger::INFO, 'green'),
- array(Logger::WARNING, 'yellow'),
- array(Logger::ERROR, 'red'),
- array(Logger::CRITICAL, 'red'),
- array(Logger::ALERT, 'red'),
- array(Logger::EMERGENCY,'red'),
- array(Logger::NOTICE, 'green'),
- );
- }
-
- /**
- * @dataProvider provideBatchRecords
- */
- public function testHandleBatch($records, $expectedColor)
- {
- $this->createHandler();
-
- $this->handler->handleBatch($records);
-
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/color='.$expectedColor.'/', $content);
- }
-
- public function provideBatchRecords()
- {
- return array(
- array(
- array(
- array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()),
- array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()),
- array('level' => Logger::CRITICAL, 'message' => 'Everything is broken!', 'level_name' => 'critical', 'datetime' => new \DateTime())
- ),
- 'red',
- ),
- array(
- array(
- array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()),
- array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()),
- ),
- 'yellow',
- ),
- array(
- array(
- array('level' => Logger::DEBUG, 'message' => 'Just debugging.', 'level_name' => 'debug', 'datetime' => new \DateTime()),
- array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()),
- ),
- 'green',
- ),
- array(
- array(
- array('level' => Logger::DEBUG, 'message' => 'Just debugging.', 'level_name' => 'debug', 'datetime' => new \DateTime()),
- ),
- 'gray',
- ),
- );
- }
-
- private function createHandler($token = 'myToken', $room = 'room1', $name = 'Monolog', $notify = false, $host = 'api.hipchat.com')
- {
- $constructorArgs = array($token, $room, $name, $notify, Logger::DEBUG, true, true, 'text', $host);
- $this->res = fopen('php://memory', 'a');
- $this->handler = $this->getMock(
- '\Monolog\Handler\HipChatHandler',
- array('fsockopen', 'streamSetTimeout', 'closeSocket'),
- $constructorArgs
- );
-
- $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
- $reflectionProperty->setAccessible(true);
- $reflectionProperty->setValue($this->handler, 'localhost:1234');
-
- $this->handler->expects($this->any())
- ->method('fsockopen')
- ->will($this->returnValue($this->res));
- $this->handler->expects($this->any())
- ->method('streamSetTimeout')
- ->will($this->returnValue(true));
- $this->handler->expects($this->any())
- ->method('closeSocket')
- ->will($this->returnValue(true));
-
- $this->handler->setFormatter($this->getIdentityFormatter());
- }
-
- /**
- * @expectedException InvalidArgumentException
- */
- public function testCreateWithTooLongName()
- {
- $hipChatHandler = new \Monolog\Handler\HipChatHandler('token', 'room', 'SixteenCharsHere');
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php
deleted file mode 100644
index 7af60be..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\TestCase;
-use Monolog\Logger;
-
-/**
- * @author Robert Kaufmann III <ro...@rok3.me>
- */
-class LogEntriesHandlerTest extends TestCase
-{
- /**
- * @var resource
- */
- private $res;
-
- /**
- * @var LogEntriesHandler
- */
- private $handler;
-
- public function testWriteContent()
- {
- $this->createHandler();
- $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Critical write test'));
-
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] test.CRITICAL: Critical write test/', $content);
- }
-
- public function testWriteBatchContent()
- {
- $records = array(
- $this->getRecord(),
- $this->getRecord(),
- $this->getRecord()
- );
- $this->createHandler();
- $this->handler->handleBatch($records);
-
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/(testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] .* \[\] \[\]\n){3}/', $content);
- }
-
- private function createHandler()
- {
- $useSSL = extension_loaded('openssl');
- $args = array('testToken', $useSSL, Logger::DEBUG, true);
- $this->res = fopen('php://memory', 'a');
- $this->handler = $this->getMock(
- '\Monolog\Handler\LogEntriesHandler',
- array('fsockopen', 'streamSetTimeout', 'closeSocket'),
- $args
- );
-
- $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
- $reflectionProperty->setAccessible(true);
- $reflectionProperty->setValue($this->handler, 'localhost:1234');
-
- $this->handler->expects($this->any())
- ->method('fsockopen')
- ->will($this->returnValue($this->res));
- $this->handler->expects($this->any())
- ->method('streamSetTimeout')
- ->will($this->returnValue(true));
- $this->handler->expects($this->any())
- ->method('closeSocket')
- ->will($this->returnValue(true));
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php
deleted file mode 100644
index 6754f3d..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-use Monolog\TestCase;
-
-class MailHandlerTest extends TestCase
-{
- /**
- * @covers Monolog\Handler\MailHandler::handleBatch
- */
- public function testHandleBatch()
- {
- $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
- $formatter->expects($this->once())
- ->method('formatBatch'); // Each record is formatted
-
- $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler');
- $handler->expects($this->once())
- ->method('send');
- $handler->expects($this->never())
- ->method('write'); // write is for individual records
-
- $handler->setFormatter($formatter);
-
- $handler->handleBatch($this->getMultipleRecords());
- }
-
- /**
- * @covers Monolog\Handler\MailHandler::handleBatch
- */
- public function testHandleBatchNotSendsMailIfMessagesAreBelowLevel()
- {
- $records = array(
- $this->getRecord(Logger::DEBUG, 'debug message 1'),
- $this->getRecord(Logger::DEBUG, 'debug message 2'),
- $this->getRecord(Logger::INFO, 'information'),
- );
-
- $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler');
- $handler->expects($this->never())
- ->method('send');
- $handler->setLevel(Logger::ERROR);
-
- $handler->handleBatch($records);
- }
-
- /**
- * @covers Monolog\Handler\MailHandler::write
- */
- public function testHandle()
- {
- $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler');
-
- $record = $this->getRecord();
- $records = array($record);
- $records[0]['formatted'] = '['.$record['datetime']->format('Y-m-d H:i:s').'] test.WARNING: test [] []'."\n";
-
- $handler->expects($this->once())
- ->method('send')
- ->with($records[0]['formatted'], $records);
-
- $handler->handle($record);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php b/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php
deleted file mode 100644
index fbaab9b..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Raven_Client;
-
-class MockRavenClient extends Raven_Client
-{
- public function capture($data, $stack, $vars = null)
- {
- $this->lastData = $data;
- $this->lastStack = $stack;
- }
-
- public $lastData;
- public $lastStack;
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php
deleted file mode 100644
index 0fdef63..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\TestCase;
-use Monolog\Logger;
-
-class MongoDBHandlerTest extends TestCase
-{
- /**
- * @expectedException InvalidArgumentException
- */
- public function testConstructorShouldThrowExceptionForInvalidMongo()
- {
- new MongoDBHandler(new \stdClass(), 'DB', 'Collection');
- }
-
- public function testHandle()
- {
- $mongo = $this->getMock('Mongo', array('selectCollection'), array(), '', false);
- $collection = $this->getMock('stdClass', array('save'));
-
- $mongo->expects($this->once())
- ->method('selectCollection')
- ->with('DB', 'Collection')
- ->will($this->returnValue($collection));
-
- $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
-
- $expected = array(
- 'message' => 'test',
- 'context' => array('data' => '[object] (stdClass: {})', 'foo' => 34),
- 'level' => Logger::WARNING,
- 'level_name' => 'WARNING',
- 'channel' => 'test',
- 'datetime' => $record['datetime']->format('Y-m-d H:i:s'),
- 'extra' => array(),
- );
-
- $collection->expects($this->once())
- ->method('save')
- ->with($expected);
-
- $handler = new MongoDBHandler($mongo, 'DB', 'Collection');
- $handler->handle($record);
- }
-}
-
-if (!class_exists('Mongo')) {
- class Mongo
- {
- public function selectCollection()
- {
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php
deleted file mode 100644
index c2553ee..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\TestCase;
-
-class NativeMailerHandlerTest extends TestCase
-{
- /**
- * @expectedException InvalidArgumentException
- */
- public function testConstructorHeaderInjection()
- {
- $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', "receiver@example.org\r\nFrom: faked@attacker.org");
- }
-
- /**
- * @expectedException InvalidArgumentException
- */
- public function testSetterHeaderInjection()
- {
- $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org');
- $mailer->addHeader("Content-Type: text/html\r\nFrom: faked@attacker.org");
- }
-
- /**
- * @expectedException InvalidArgumentException
- */
- public function testSetterArrayHeaderInjection()
- {
- $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org');
- $mailer->addHeader(array("Content-Type: text/html\r\nFrom: faked@attacker.org"));
- }
-
- /**
- * @expectedException InvalidArgumentException
- */
- public function testSetterContentTypeInjection()
- {
- $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org');
- $mailer->setContentType("text/html\r\nFrom: faked@attacker.org");
- }
-
- /**
- * @expectedException InvalidArgumentException
- */
- public function testSetterEncodingInjection()
- {
- $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org');
- $mailer->setEncoding("utf-8\r\nFrom: faked@attacker.org");
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php
deleted file mode 100644
index 4eda615..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php
+++ /dev/null
@@ -1,192 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\TestCase;
-use Monolog\Logger;
-
-class NewRelicHandlerTest extends TestCase
-{
- public static $appname;
- public static $customParameters;
- public static $transactionName;
-
- public function setUp()
- {
- self::$appname = null;
- self::$customParameters = array();
- self::$transactionName = null;
- }
-
- /**
- * @expectedException Monolog\Handler\MissingExtensionException
- */
- public function testThehandlerThrowsAnExceptionIfTheNRExtensionIsNotLoaded()
- {
- $handler = new StubNewRelicHandlerWithoutExtension();
- $handler->handle($this->getRecord(Logger::ERROR));
- }
-
- public function testThehandlerCanHandleTheRecord()
- {
- $handler = new StubNewRelicHandler();
- $handler->handle($this->getRecord(Logger::ERROR));
- }
-
- public function testThehandlerCanAddContextParamsToTheNewRelicTrace()
- {
- $handler = new StubNewRelicHandler();
- $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('a' => 'b')));
- $this->assertEquals(array('context_a' => 'b'), self::$customParameters);
- }
-
- public function testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace()
- {
- $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true);
- $handler->handle($this->getRecord(
- Logger::ERROR,
- 'log message',
- array('a' => array('key1' => 'value1', 'key2' => 'value2'))
- ));
- $this->assertEquals(
- array('context_a_key1' => 'value1', 'context_a_key2' => 'value2'),
- self::$customParameters
- );
- }
-
- public function testThehandlerCanAddExtraParamsToTheNewRelicTrace()
- {
- $record = $this->getRecord(Logger::ERROR, 'log message');
- $record['extra'] = array('c' => 'd');
-
- $handler = new StubNewRelicHandler();
- $handler->handle($record);
-
- $this->assertEquals(array('extra_c' => 'd'), self::$customParameters);
- }
-
- public function testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace()
- {
- $record = $this->getRecord(Logger::ERROR, 'log message');
- $record['extra'] = array('c' => array('key1' => 'value1', 'key2' => 'value2'));
-
- $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true);
- $handler->handle($record);
-
- $this->assertEquals(
- array('extra_c_key1' => 'value1', 'extra_c_key2' => 'value2'),
- self::$customParameters
- );
- }
-
- public function testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace()
- {
- $record = $this->getRecord(Logger::ERROR, 'log message', array('a' => 'b'));
- $record['extra'] = array('c' => 'd');
-
- $handler = new StubNewRelicHandler();
- $handler->handle($record);
-
- $expected = array(
- 'context_a' => 'b',
- 'extra_c' => 'd',
- );
-
- $this->assertEquals($expected, self::$customParameters);
- }
-
- public function testTheAppNameIsNullByDefault()
- {
- $handler = new StubNewRelicHandler();
- $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
-
- $this->assertEquals(null, self::$appname);
- }
-
- public function testTheAppNameCanBeInjectedFromtheConstructor()
- {
- $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName');
- $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
-
- $this->assertEquals('myAppName', self::$appname);
- }
-
- public function testTheAppNameCanBeOverriddenFromEachLog()
- {
- $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName');
- $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('appname' => 'logAppName')));
-
- $this->assertEquals('logAppName', self::$appname);
- }
-
- public function testTheTransactionNameIsNullByDefault()
- {
- $handler = new StubNewRelicHandler();
- $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
-
- $this->assertEquals(null, self::$transactionName);
- }
-
- public function testTheTransactionNameCanBeInjectedFromTheConstructor()
- {
- $handler = new StubNewRelicHandler(Logger::DEBUG, false, null, false, 'myTransaction');
- $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
-
- $this->assertEquals('myTransaction', self::$transactionName);
- }
-
- public function testTheTransactionNameCanBeOverriddenFromEachLog()
- {
- $handler = new StubNewRelicHandler(Logger::DEBUG, false, null, false, 'myTransaction');
- $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('transaction_name' => 'logTransactName')));
-
- $this->assertEquals('logTransactName', self::$transactionName);
- }
-}
-
-class StubNewRelicHandlerWithoutExtension extends NewRelicHandler
-{
- protected function isNewRelicEnabled()
- {
- return false;
- }
-}
-
-class StubNewRelicHandler extends NewRelicHandler
-{
- protected function isNewRelicEnabled()
- {
- return true;
- }
-}
-
-function newrelic_notice_error()
-{
- return true;
-}
-
-function newrelic_set_appname($appname)
-{
- return NewRelicHandlerTest::$appname = $appname;
-}
-
-function newrelic_name_transaction($transactionName)
-{
- return NewRelicHandlerTest::$transactionName = $transactionName;
-}
-
-function newrelic_add_custom_parameter($key, $value)
-{
- NewRelicHandlerTest::$customParameters[$key] = $value;
-
- return true;
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php
deleted file mode 100644
index 292df78..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\TestCase;
-use Monolog\Logger;
-
-/**
- * @covers Monolog\Handler\NullHandler::handle
- */
-class NullHandlerTest extends TestCase
-{
- public function testHandle()
- {
- $handler = new NullHandler();
- $this->assertTrue($handler->handle($this->getRecord()));
- }
-
- public function testHandleLowerLevelRecord()
- {
- $handler = new NullHandler(Logger::WARNING);
- $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php
deleted file mode 100644
index 64eaab1..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\TestCase;
-use Monolog\Logger;
-
-/**
- * @covers Monolog\Handler\PsrHandler::handle
- */
-class PsrHandlerTest extends TestCase
-{
- public function logLevelProvider()
- {
- $levels = array();
- $monologLogger = new Logger('');
-
- foreach ($monologLogger->getLevels() as $levelName => $level) {
- $levels[] = array($levelName, $level);
- }
-
- return $levels;
- }
-
- /**
- * @dataProvider logLevelProvider
- */
- public function testHandlesAllLevels($levelName, $level)
- {
- $message = 'Hello, world! ' . $level;
- $context = array('foo' => 'bar', 'level' => $level);
-
- $psrLogger = $this->getMock('Psr\Log\NullLogger');
- $psrLogger->expects($this->once())
- ->method('log')
- ->with(strtolower($levelName), $message, $context);
-
- $handler = new PsrHandler($psrLogger);
- $handler->handle(array('level' => $level, 'level_name' => $levelName, 'message' => $message, 'context' => $context));
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php
----------------------------------------------------------------------
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php
deleted file mode 100644
index 8940823..0000000
--- a/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php
+++ /dev/null
@@ -1,141 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j....@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\TestCase;
-use Monolog\Logger;
-
-/**
- * Almost all examples (expected header, titles, messages) taken from
- * https://www.pushover.net/api
- * @author Sebastian Göttschkes <se...@googlemail.com>
- * @see https://www.pushover.net/api
- */
-class PushoverHandlerTest extends TestCase
-{
- private $res;
- private $handler;
-
- public function testWriteHeader()
- {
- $this->createHandler();
- $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications
- $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/POST \/1\/messages.json HTTP\/1.1\\r\\nHost: api.pushover.net\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
-
- return $content;
- }
-
- /**
- * @depends testWriteHeader
- */
- public function testWriteContent($content)
- {
- $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}$/', $content);
- }
-
- public function testWriteWithComplexTitle()
- {
- $this->createHandler('myToken', 'myUser', 'Backup finished - SQL1', Logger::EMERGENCY);
- $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/title=Backup\+finished\+-\+SQL1/', $content);
- }
-
- public function testWriteWithComplexMessage()
- {
- $this->createHandler();
- $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications
- $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Backup of database "example" finished in 16 minutes.'));
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content);
- }
-
- public function testWriteWithTooLongMessage()
- {
- $message = str_pad('test', 520, 'a');
- $this->createHandler();
- $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications
- $this->handler->handle($this->getRecord(Logger::CRITICAL, $message));
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $expectedMessage = substr($message, 0, 505);
-
- $this->assertRegexp('/message=' . $expectedMessage . '&title/', $content);
- }
-
- public function testWriteWithHighPriority()
- {
- $this->createHandler();
- $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=1$/', $content);
- }
-
- public function testWriteWithEmergencyPriority()
- {
- $this->createHandler();
- $this->handler->handle($this->getRecord(Logger::EMERGENCY, 'test1'));
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content);
- }
-
- public function testWriteToMultipleUsers()
- {
- $this->createHandler('myToken', array('userA', 'userB'));
- $this->handler->handle($this->getRecord(Logger::EMERGENCY, 'test1'));
- fseek($this->res, 0);
- $content = fread($this->res, 1024);
-
- $this->assertRegexp('/token=myToken&user=userA&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200POST/', $content);
- $this->assertRegexp('/token=myToken&user=userB&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content);
- }
-
- private function createHandler($token = 'myToken', $user = 'myUser', $title = 'Monolog')
- {
- $constructorArgs = array($token, $user, $title);
- $this->res = fopen('php://memory', 'a');
- $this->handler = $this->getMock(
- '\Monolog\Handler\PushoverHandler',
- array('fsockopen', 'streamSetTimeout', 'closeSocket'),
- $constructorArgs
- );
-
- $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
- $reflectionProperty->setAccessible(true);
- $reflectionProperty->setValue($this->handler, 'localhost:1234');
-
- $this->handler->expects($this->any())
- ->method('fsockopen')
- ->will($this->returnValue($this->res));
- $this->handler->expects($this->any())
- ->method('streamSetTimeout')
- ->will($this->returnValue(true));
- $this->handler->expects($this->any())
- ->method('closeSocket')
- ->will($this->returnValue(true));
-
- $this->handler->setFormatter($this->getIdentityFormatter());
- }
-}