@@ -7,79 +7,79 @@ |
||
7 | 7 | // namespace hack on microtime functionality |
8 | 8 | function microtime() |
9 | 9 | { |
10 | - return 1450355136.5706; |
|
10 | + return 1450355136.5706; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | // namespace hack on included files functionality |
14 | 14 | function get_included_files() |
15 | 15 | { |
16 | - return array( |
|
17 | - 'index.php', |
|
18 | - 'src/Class.php' |
|
19 | - ); |
|
16 | + return array( |
|
17 | + 'index.php', |
|
18 | + 'src/Class.php' |
|
19 | + ); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | // namespace hack on filesize |
23 | 23 | function filesize($filename) |
24 | 24 | { |
25 | - return strlen($filename) * 100; |
|
25 | + return strlen($filename) * 100; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | class PhpQuickProfilerTest extends PHPUnit_Framework_TestCase |
29 | 29 | { |
30 | 30 | |
31 | - public function testConstruct() |
|
32 | - { |
|
33 | - $startTime = microtime(true); |
|
34 | - |
|
35 | - $profiler = new PhpQuickProfiler(); |
|
36 | - $this->assertAttributeEquals($startTime, 'startTime', $profiler); |
|
37 | - |
|
38 | - $profiler = new PhpQuickProfiler($startTime); |
|
39 | - $this->assertAttributeEquals($startTime, 'startTime', $profiler); |
|
40 | - } |
|
41 | - |
|
42 | - public function testSetConsole() |
|
43 | - { |
|
44 | - $console = new Console(); |
|
45 | - $profiler = new PhpQuickProfiler(); |
|
46 | - $profiler->setConsole($console); |
|
47 | - |
|
48 | - $this->assertAttributeSame($console, 'console', $profiler); |
|
49 | - } |
|
50 | - |
|
51 | - public function testSetDisplay() |
|
52 | - { |
|
53 | - $display = new Display(); |
|
54 | - $profiler = new PhpQuickProfiler(); |
|
55 | - $profiler->setDisplay($display); |
|
56 | - |
|
57 | - $this->assertAttributeSame($display, 'display', $profiler); |
|
58 | - } |
|
59 | - |
|
60 | - public function testGatherFileData() |
|
61 | - { |
|
62 | - $files = get_included_files(); |
|
63 | - $profiler = new PhpQuickProfiler(); |
|
64 | - $gatheredFileData = $profiler->gatherFileData(); |
|
65 | - |
|
66 | - foreach ($gatheredFileData as $fileData) { |
|
67 | - $this->assertArrayHasKey('name', $fileData); |
|
68 | - $this->assertContains($fileData['name'], $files); |
|
69 | - $this->assertArrayHasKey('size', $fileData); |
|
70 | - $this->assertEquals($fileData['size'], filesize($fileData['name'])); |
|
71 | - } |
|
72 | - } |
|
73 | - |
|
74 | - public function testSetProfiledQueries() |
|
75 | - { |
|
76 | - $profiledQueries = array( |
|
77 | - 'sql' => 'SELECT * FROM example', |
|
78 | - 'time' => 25 |
|
79 | - ); |
|
80 | - $profiler = new PhpQuickProfiler(); |
|
81 | - $profiler->setProfiledQueries($profiledQueries); |
|
82 | - |
|
83 | - $this->assertAttributeEquals($profiledQueries, 'profiledQueries', $profiler); |
|
84 | - } |
|
31 | + public function testConstruct() |
|
32 | + { |
|
33 | + $startTime = microtime(true); |
|
34 | + |
|
35 | + $profiler = new PhpQuickProfiler(); |
|
36 | + $this->assertAttributeEquals($startTime, 'startTime', $profiler); |
|
37 | + |
|
38 | + $profiler = new PhpQuickProfiler($startTime); |
|
39 | + $this->assertAttributeEquals($startTime, 'startTime', $profiler); |
|
40 | + } |
|
41 | + |
|
42 | + public function testSetConsole() |
|
43 | + { |
|
44 | + $console = new Console(); |
|
45 | + $profiler = new PhpQuickProfiler(); |
|
46 | + $profiler->setConsole($console); |
|
47 | + |
|
48 | + $this->assertAttributeSame($console, 'console', $profiler); |
|
49 | + } |
|
50 | + |
|
51 | + public function testSetDisplay() |
|
52 | + { |
|
53 | + $display = new Display(); |
|
54 | + $profiler = new PhpQuickProfiler(); |
|
55 | + $profiler->setDisplay($display); |
|
56 | + |
|
57 | + $this->assertAttributeSame($display, 'display', $profiler); |
|
58 | + } |
|
59 | + |
|
60 | + public function testGatherFileData() |
|
61 | + { |
|
62 | + $files = get_included_files(); |
|
63 | + $profiler = new PhpQuickProfiler(); |
|
64 | + $gatheredFileData = $profiler->gatherFileData(); |
|
65 | + |
|
66 | + foreach ($gatheredFileData as $fileData) { |
|
67 | + $this->assertArrayHasKey('name', $fileData); |
|
68 | + $this->assertContains($fileData['name'], $files); |
|
69 | + $this->assertArrayHasKey('size', $fileData); |
|
70 | + $this->assertEquals($fileData['size'], filesize($fileData['name'])); |
|
71 | + } |
|
72 | + } |
|
73 | + |
|
74 | + public function testSetProfiledQueries() |
|
75 | + { |
|
76 | + $profiledQueries = array( |
|
77 | + 'sql' => 'SELECT * FROM example', |
|
78 | + 'time' => 25 |
|
79 | + ); |
|
80 | + $profiler = new PhpQuickProfiler(); |
|
81 | + $profiler->setProfiledQueries($profiledQueries); |
|
82 | + |
|
83 | + $this->assertAttributeEquals($profiledQueries, 'profiledQueries', $profiler); |
|
84 | + } |
|
85 | 85 | } |