ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Monolog\Handler\NewRelicHandlerTest Class Reference
+ Inheritance diagram for Monolog\Handler\NewRelicHandlerTest:
+ Collaboration diagram for Monolog\Handler\NewRelicHandlerTest:

Public Member Functions

 setUp ()
 
 testThehandlerThrowsAnExceptionIfTheNRExtensionIsNotLoaded ()
 Monolog More...
 
 testThehandlerCanHandleTheRecord ()
 
 testThehandlerCanAddContextParamsToTheNewRelicTrace ()
 
 testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace ()
 
 testThehandlerCanAddExtraParamsToTheNewRelicTrace ()
 
 testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace ()
 
 testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace ()
 
 testThehandlerCanHandleTheRecordsFormattedUsingTheLineFormatter ()
 
 testTheAppNameIsNullByDefault ()
 
 testTheAppNameCanBeInjectedFromtheConstructor ()
 
 testTheAppNameCanBeOverriddenFromEachLog ()
 
 testTheTransactionNameIsNullByDefault ()
 
 testTheTransactionNameCanBeInjectedFromTheConstructor ()
 
 testTheTransactionNameCanBeOverriddenFromEachLog ()
 

Static Public Attributes

static $appname
 
static $customParameters
 
static $transactionName
 

Additional Inherited Members

- Protected Member Functions inherited from Monolog\TestCase
 getRecord ($level=Logger::WARNING, $message='test', $context=array())
 
 getMultipleRecords ()
 
 getIdentityFormatter ()
 

Detailed Description

Definition at line 18 of file NewRelicHandlerTest.php.

Member Function Documentation

◆ setUp()

Monolog\Handler\NewRelicHandlerTest::setUp ( )

Definition at line 24 of file NewRelicHandlerTest.php.

References array.

25  {
26  self::$appname = null;
27  self::$customParameters = array();
28  self::$transactionName = null;
29  }
Create styles array
The data for the language used.

◆ testTheAppNameCanBeInjectedFromtheConstructor()

Monolog\Handler\NewRelicHandlerTest::testTheAppNameCanBeInjectedFromtheConstructor ( )

Definition at line 123 of file NewRelicHandlerTest.php.

References $handler, Monolog\Logger\DEBUG, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

124  {
125  $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName');
126  $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
127 
128  $this->assertEquals('myAppName', self::$appname);
129  }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$handler
+ Here is the call graph for this function:

◆ testTheAppNameCanBeOverriddenFromEachLog()

Monolog\Handler\NewRelicHandlerTest::testTheAppNameCanBeOverriddenFromEachLog ( )

Definition at line 131 of file NewRelicHandlerTest.php.

References $handler, array, Monolog\Logger\DEBUG, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

132  {
133  $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName');
134  $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('appname' => 'logAppName')));
135 
136  $this->assertEquals('logAppName', self::$appname);
137  }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
Create styles array
The data for the language used.
$handler
+ Here is the call graph for this function:

◆ testTheAppNameIsNullByDefault()

Monolog\Handler\NewRelicHandlerTest::testTheAppNameIsNullByDefault ( )

Definition at line 115 of file NewRelicHandlerTest.php.

References $handler, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

116  {
117  $handler = new StubNewRelicHandler();
118  $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
119 
120  $this->assertEquals(null, self::$appname);
121  }
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$handler
+ Here is the call graph for this function:

◆ testThehandlerCanAddContextParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddContextParamsToTheNewRelicTrace ( )

Definition at line 46 of file NewRelicHandlerTest.php.

References $handler, array, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

47  {
48  $handler = new StubNewRelicHandler();
49  $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('a' => 'b')));
50  $this->assertEquals(array('context_a' => 'b'), self::$customParameters);
51  }
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
Create styles array
The data for the language used.
$handler
+ Here is the call graph for this function:

◆ testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace ( )

Definition at line 53 of file NewRelicHandlerTest.php.

References $handler, array, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

54  {
55  $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true);
56  $handler->handle($this->getRecord(
58  'log message',
59  array('a' => array('key1' => 'value1', 'key2' => 'value2'))
60  ));
61  $this->assertEquals(
62  array('context_a_key1' => 'value1', 'context_a_key2' => 'value2'),
63  self::$customParameters
64  );
65  }
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
Create styles array
The data for the language used.
$handler
+ Here is the call graph for this function:

◆ testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace ( )

Definition at line 78 of file NewRelicHandlerTest.php.

References $handler, array, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

79  {
80  $record = $this->getRecord(Logger::ERROR, 'log message');
81  $record['extra'] = array('c' => array('key1' => 'value1', 'key2' => 'value2'));
82 
83  $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true);
84  $handler->handle($record);
85 
86  $this->assertEquals(
87  array('extra_c_key1' => 'value1', 'extra_c_key2' => 'value2'),
88  self::$customParameters
89  );
90  }
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
Create styles array
The data for the language used.
$handler
+ Here is the call graph for this function:

◆ testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace ( )

Definition at line 92 of file NewRelicHandlerTest.php.

References $handler, array, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

93  {
94  $record = $this->getRecord(Logger::ERROR, 'log message', array('a' => 'b'));
95  $record['extra'] = array('c' => 'd');
96 
97  $handler = new StubNewRelicHandler();
98  $handler->handle($record);
99 
100  $expected = array(
101  'context_a' => 'b',
102  'extra_c' => 'd',
103  );
104 
105  $this->assertEquals($expected, self::$customParameters);
106  }
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
Create styles array
The data for the language used.
$handler
+ Here is the call graph for this function:

◆ testThehandlerCanAddExtraParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddExtraParamsToTheNewRelicTrace ( )

Definition at line 67 of file NewRelicHandlerTest.php.

References $handler, array, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

68  {
69  $record = $this->getRecord(Logger::ERROR, 'log message');
70  $record['extra'] = array('c' => 'd');
71 
72  $handler = new StubNewRelicHandler();
73  $handler->handle($record);
74 
75  $this->assertEquals(array('extra_c' => 'd'), self::$customParameters);
76  }
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
Create styles array
The data for the language used.
$handler
+ Here is the call graph for this function:

◆ testThehandlerCanHandleTheRecord()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanHandleTheRecord ( )

Definition at line 40 of file NewRelicHandlerTest.php.

References $handler, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

41  {
42  $handler = new StubNewRelicHandler();
43  $handler->handle($this->getRecord(Logger::ERROR));
44  }
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$handler
+ Here is the call graph for this function:

◆ testThehandlerCanHandleTheRecordsFormattedUsingTheLineFormatter()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanHandleTheRecordsFormattedUsingTheLineFormatter ( )

Definition at line 108 of file NewRelicHandlerTest.php.

References $handler, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

109  {
110  $handler = new StubNewRelicHandler();
111  $handler->setFormatter(new LineFormatter());
112  $handler->handle($this->getRecord(Logger::ERROR));
113  }
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$handler
+ Here is the call graph for this function:

◆ testThehandlerThrowsAnExceptionIfTheNRExtensionIsNotLoaded()

Monolog\Handler\NewRelicHandlerTest::testThehandlerThrowsAnExceptionIfTheNRExtensionIsNotLoaded ( )

Monolog

Definition at line 34 of file NewRelicHandlerTest.php.

References $handler, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

35  {
36  $handler = new StubNewRelicHandlerWithoutExtension();
37  $handler->handle($this->getRecord(Logger::ERROR));
38  }
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$handler
+ Here is the call graph for this function:

◆ testTheTransactionNameCanBeInjectedFromTheConstructor()

Monolog\Handler\NewRelicHandlerTest::testTheTransactionNameCanBeInjectedFromTheConstructor ( )

Definition at line 147 of file NewRelicHandlerTest.php.

References $handler, Monolog\Logger\DEBUG, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

148  {
149  $handler = new StubNewRelicHandler(Logger::DEBUG, false, null, false, 'myTransaction');
150  $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
151 
152  $this->assertEquals('myTransaction', self::$transactionName);
153  }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$handler
+ Here is the call graph for this function:

◆ testTheTransactionNameCanBeOverriddenFromEachLog()

Monolog\Handler\NewRelicHandlerTest::testTheTransactionNameCanBeOverriddenFromEachLog ( )

Definition at line 155 of file NewRelicHandlerTest.php.

References $handler, array, Monolog\Logger\DEBUG, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

156  {
157  $handler = new StubNewRelicHandler(Logger::DEBUG, false, null, false, 'myTransaction');
158  $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('transaction_name' => 'logTransactName')));
159 
160  $this->assertEquals('logTransactName', self::$transactionName);
161  }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
Create styles array
The data for the language used.
$handler
+ Here is the call graph for this function:

◆ testTheTransactionNameIsNullByDefault()

Monolog\Handler\NewRelicHandlerTest::testTheTransactionNameIsNullByDefault ( )

Definition at line 139 of file NewRelicHandlerTest.php.

References $handler, Monolog\Logger\ERROR, and Monolog\TestCase\getRecord().

140  {
141  $handler = new StubNewRelicHandler();
142  $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
143 
144  $this->assertEquals(null, self::$transactionName);
145  }
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$handler
+ Here is the call graph for this function:

Field Documentation

◆ $appname

Monolog\Handler\NewRelicHandlerTest::$appname
static

Definition at line 20 of file NewRelicHandlerTest.php.

Referenced by Monolog\Handler\newrelic_set_appname().

◆ $customParameters

Monolog\Handler\NewRelicHandlerTest::$customParameters
static

◆ $transactionName

Monolog\Handler\NewRelicHandlerTest::$transactionName
static

Definition at line 22 of file NewRelicHandlerTest.php.

Referenced by Monolog\Handler\newrelic_name_transaction().


The documentation for this class was generated from the following file: