ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Monolog\Handler\NewRelicHandlerTest Class Reference
+ Inheritance diagram for Monolog\Handler\NewRelicHandlerTest:
+ Collaboration diagram for Monolog\Handler\NewRelicHandlerTest:

Public Member Functions

 setUp ()
 
 testThehandlerThrowsAnExceptionIfTheNRExtensionIsNotLoaded ()
 @expectedException Monolog\Handler\MissingExtensionException 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.

25 {
26 self::$appname = null;
27 self::$customParameters = array();
28 self::$transactionName = null;
29 }

◆ testTheAppNameCanBeInjectedFromtheConstructor()

Monolog\Handler\NewRelicHandlerTest::testTheAppNameCanBeInjectedFromtheConstructor ( )

Definition at line 123 of file NewRelicHandlerTest.php.

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 ERROR
Runtime errors.
Definition: Logger.php:58
const DEBUG
Detailed debug information.
Definition: Logger.php:33
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$handler

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

+ Here is the call graph for this function:

◆ testTheAppNameCanBeOverriddenFromEachLog()

Monolog\Handler\NewRelicHandlerTest::testTheAppNameCanBeOverriddenFromEachLog ( )

Definition at line 131 of file NewRelicHandlerTest.php.

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 }

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

+ Here is the call graph for this function:

◆ testTheAppNameIsNullByDefault()

Monolog\Handler\NewRelicHandlerTest::testTheAppNameIsNullByDefault ( )

Definition at line 115 of file NewRelicHandlerTest.php.

116 {
117 $handler = new StubNewRelicHandler();
118 $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
119
120 $this->assertEquals(null, self::$appname);
121 }

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

+ Here is the call graph for this function:

◆ testThehandlerCanAddContextParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddContextParamsToTheNewRelicTrace ( )

Definition at line 46 of file NewRelicHandlerTest.php.

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 }

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

+ Here is the call graph for this function:

◆ testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace ( )

Definition at line 53 of file NewRelicHandlerTest.php.

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 }

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

+ Here is the call graph for this function:

◆ testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace ( )

Definition at line 78 of file NewRelicHandlerTest.php.

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 }

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

+ Here is the call graph for this function:

◆ testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace ( )

Definition at line 92 of file NewRelicHandlerTest.php.

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 }

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

+ Here is the call graph for this function:

◆ testThehandlerCanAddExtraParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddExtraParamsToTheNewRelicTrace ( )

Definition at line 67 of file NewRelicHandlerTest.php.

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 }

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

+ Here is the call graph for this function:

◆ testThehandlerCanHandleTheRecord()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanHandleTheRecord ( )

Definition at line 40 of file NewRelicHandlerTest.php.

41 {
42 $handler = new StubNewRelicHandler();
43 $handler->handle($this->getRecord(Logger::ERROR));
44 }

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

+ Here is the call graph for this function:

◆ testThehandlerCanHandleTheRecordsFormattedUsingTheLineFormatter()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanHandleTheRecordsFormattedUsingTheLineFormatter ( )

Definition at line 108 of file NewRelicHandlerTest.php.

109 {
110 $handler = new StubNewRelicHandler();
111 $handler->setFormatter(new LineFormatter());
112 $handler->handle($this->getRecord(Logger::ERROR));
113 }

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

+ Here is the call graph for this function:

◆ testThehandlerThrowsAnExceptionIfTheNRExtensionIsNotLoaded()

Monolog\Handler\NewRelicHandlerTest::testThehandlerThrowsAnExceptionIfTheNRExtensionIsNotLoaded ( )

@expectedException Monolog\Handler\MissingExtensionException

Definition at line 34 of file NewRelicHandlerTest.php.

35 {
36 $handler = new StubNewRelicHandlerWithoutExtension();
37 $handler->handle($this->getRecord(Logger::ERROR));
38 }

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

+ Here is the call graph for this function:

◆ testTheTransactionNameCanBeInjectedFromTheConstructor()

Monolog\Handler\NewRelicHandlerTest::testTheTransactionNameCanBeInjectedFromTheConstructor ( )

Definition at line 147 of file NewRelicHandlerTest.php.

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 }

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

+ Here is the call graph for this function:

◆ testTheTransactionNameCanBeOverriddenFromEachLog()

Monolog\Handler\NewRelicHandlerTest::testTheTransactionNameCanBeOverriddenFromEachLog ( )

Definition at line 155 of file NewRelicHandlerTest.php.

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 }

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

+ Here is the call graph for this function:

◆ testTheTransactionNameIsNullByDefault()

Monolog\Handler\NewRelicHandlerTest::testTheTransactionNameIsNullByDefault ( )

Definition at line 139 of file NewRelicHandlerTest.php.

140 {
141 $handler = new StubNewRelicHandler();
142 $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
143
144 $this->assertEquals(null, self::$transactionName);
145 }

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

+ 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: