ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ()
 
 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 17 of file NewRelicHandlerTest.php.

Member Function Documentation

◆ setUp()

Monolog\Handler\NewRelicHandlerTest::setUp ( )

Definition at line 23 of file NewRelicHandlerTest.php.

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

◆ testTheAppNameCanBeInjectedFromtheConstructor()

Monolog\Handler\NewRelicHandlerTest::testTheAppNameCanBeInjectedFromtheConstructor ( )

Definition at line 115 of file NewRelicHandlerTest.php.

116 {
117 $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName');
118 $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
119
120 $this->assertEquals('myAppName', self::$appname);
121 }
const ERROR
Runtime errors.
Definition: Logger.php:57
const DEBUG
Detailed debug information.
Definition: Logger.php:32
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19

References 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 123 of file NewRelicHandlerTest.php.

124 {
125 $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName');
126 $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('appname' => 'logAppName')));
127
128 $this->assertEquals('logAppName', self::$appname);
129 }

References 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 107 of file NewRelicHandlerTest.php.

108 {
109 $handler = new StubNewRelicHandler();
110 $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
111
112 $this->assertEquals(null, self::$appname);
113 }

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

+ Here is the call graph for this function:

◆ testThehandlerCanAddContextParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddContextParamsToTheNewRelicTrace ( )

Definition at line 45 of file NewRelicHandlerTest.php.

46 {
47 $handler = new StubNewRelicHandler();
48 $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('a' => 'b')));
49 $this->assertEquals(array('context_a' => 'b'), self::$customParameters);
50 }

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

+ Here is the call graph for this function:

◆ testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace ( )

Definition at line 52 of file NewRelicHandlerTest.php.

53 {
54 $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true);
55 $handler->handle($this->getRecord(
57 'log message',
58 array('a' => array('key1' => 'value1', 'key2' => 'value2'))
59 ));
60 $this->assertEquals(
61 array('context_a_key1' => 'value1', 'context_a_key2' => 'value2'),
62 self::$customParameters
63 );
64 }

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

+ Here is the call graph for this function:

◆ testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace ( )

Definition at line 77 of file NewRelicHandlerTest.php.

78 {
79 $record = $this->getRecord(Logger::ERROR, 'log message');
80 $record['extra'] = array('c' => array('key1' => 'value1', 'key2' => 'value2'));
81
82 $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true);
83 $handler->handle($record);
84
85 $this->assertEquals(
86 array('extra_c_key1' => 'value1', 'extra_c_key2' => 'value2'),
87 self::$customParameters
88 );
89 }

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

+ Here is the call graph for this function:

◆ testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace ( )

Definition at line 91 of file NewRelicHandlerTest.php.

92 {
93 $record = $this->getRecord(Logger::ERROR, 'log message', array('a' => 'b'));
94 $record['extra'] = array('c' => 'd');
95
96 $handler = new StubNewRelicHandler();
97 $handler->handle($record);
98
99 $expected = array(
100 'context_a' => 'b',
101 'extra_c' => 'd',
102 );
103
104 $this->assertEquals($expected, self::$customParameters);
105 }

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

+ Here is the call graph for this function:

◆ testThehandlerCanAddExtraParamsToTheNewRelicTrace()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanAddExtraParamsToTheNewRelicTrace ( )

Definition at line 66 of file NewRelicHandlerTest.php.

67 {
68 $record = $this->getRecord(Logger::ERROR, 'log message');
69 $record['extra'] = array('c' => 'd');
70
71 $handler = new StubNewRelicHandler();
72 $handler->handle($record);
73
74 $this->assertEquals(array('extra_c' => 'd'), self::$customParameters);
75 }

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

+ Here is the call graph for this function:

◆ testThehandlerCanHandleTheRecord()

Monolog\Handler\NewRelicHandlerTest::testThehandlerCanHandleTheRecord ( )

Definition at line 39 of file NewRelicHandlerTest.php.

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

References 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 33 of file NewRelicHandlerTest.php.

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

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

+ Here is the call graph for this function:

◆ testTheTransactionNameCanBeInjectedFromTheConstructor()

Monolog\Handler\NewRelicHandlerTest::testTheTransactionNameCanBeInjectedFromTheConstructor ( )

Definition at line 139 of file NewRelicHandlerTest.php.

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

References 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 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', array('transaction_name' => 'logTransactName')));
151
152 $this->assertEquals('logTransactName', self::$transactionName);
153 }

References 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 131 of file NewRelicHandlerTest.php.

132 {
133 $handler = new StubNewRelicHandler();
134 $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
135
136 $this->assertEquals(null, self::$transactionName);
137 }

References 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 19 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 21 of file NewRelicHandlerTest.php.

Referenced by Monolog\Handler\newrelic_name_transaction().


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