|
@@ 89-102 (lines=14) @@
|
| 86 |
|
$this->assertContains($returned_message, $logged_message); |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
public function testLoggingWithPsrContextArrayWithString() |
| 90 |
|
{ |
| 91 |
|
static_logger::setHandler(self::$log_file); |
| 92 |
|
|
| 93 |
|
$context_array = array( |
| 94 |
|
"context" => "stuff" |
| 95 |
|
); |
| 96 |
|
|
| 97 |
|
$expected_context_message = "Here is some stuff for ya."; |
| 98 |
|
|
| 99 |
|
$returned_message = static_logger::log("debug","Here is some {context} for ya.",$context_array); |
| 100 |
|
|
| 101 |
|
$this->assertContains($expected_context_message, $returned_message); |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
/** |
| 105 |
|
* @dataProvider contextArrayProvider |
|
@@ 107-118 (lines=12) @@
|
| 104 |
|
/** |
| 105 |
|
* @dataProvider contextArrayProvider |
| 106 |
|
*/ |
| 107 |
|
public function testLoggingWithPsrContextArrayWithUnparsedThings($context_array) |
| 108 |
|
{ |
| 109 |
|
static_logger::setHandler(self::$log_file); |
| 110 |
|
|
| 111 |
|
//Provided contexts that do not adhere to PSR-3 templating, the log method should write the message without |
| 112 |
|
//affecting the {context} section and not throw any exceptions. |
| 113 |
|
$expected_context_message = "Here is some {context} for ya."; |
| 114 |
|
|
| 115 |
|
$returned_message = static_logger::log("debug","Here is some {context} for ya.",$context_array); |
| 116 |
|
|
| 117 |
|
$this->assertContains($expected_context_message, $returned_message); |
| 118 |
|
} |
| 119 |
|
|
| 120 |
|
public function testLoggingWithExceptionContext() |
| 121 |
|
{ |
|
@@ 147-160 (lines=14) @@
|
| 144 |
|
/** |
| 145 |
|
* @expectedException \PHPUnit_Framework_Error |
| 146 |
|
*/ |
| 147 |
|
public function testLoggingWithNonArrayContext() |
| 148 |
|
{ |
| 149 |
|
static_logger::setHandler(self::$log_file); |
| 150 |
|
|
| 151 |
|
$context_array = 4; |
| 152 |
|
|
| 153 |
|
//Provided contexts that do not adhere to PSR-3 templating, the log method should write the message without |
| 154 |
|
//affecting the {context} section and not throw any exceptions. |
| 155 |
|
$expected_context_message = "Here is some {context} for ya."; |
| 156 |
|
|
| 157 |
|
$returned_message = static_logger::log("debug","Here is some {context} for ya.",$context_array); |
| 158 |
|
|
| 159 |
|
$this->assertContains($expected_context_message, $returned_message); |
| 160 |
|
} |
| 161 |
|
|
| 162 |
|
/** |
| 163 |
|
* Provides data for testing valid log levels. |