-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormatArgumentTest.php
38 lines (34 loc) · 1.02 KB
/
FormatArgumentTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace PolderKnowledge\LogModule\Formatter;
use PHPUnit\Framework\TestCase;
/**
* Throwable or Exception is not mockable due to its final methods
* So we cannot unittest everything
*/
class FormatArgumentTest extends TestCase
{
/**
* @dataProvider formatProvider
*/
public function testFormatArgument($argument, $expected)
{
self::assertEquals($expected, ExceptionPrinter::formatArgument($argument));
}
public function formatProvider()
{
return [
[true, 'true'],
[false, 'false'],
[[0, 0, 0], 'array(3)'],
[new \stdClass, 'stdClass'],
[fopen(__FILE__, 'r'), 'resource'],
['mystring', "'mystring'"],
[
'If there is a long string in the arguments, it should be truncated,'
. ' so that the logging stays concise',
"'If there is a long string in t...that the logging stays concise'",
],
[null, 'NULL'],
];
}
}