Completed
Push — master ( f9b271...616eb6 )
by Jacob
02:11
created

PhpQuickProfilerTest::testGetReadableTime()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 12
rs 9.4286
cc 2
eloc 7
nc 2
nop 0
1
<?php
2
3
use Particletree\Pqp\Console;
4
use Particletree\Pqp\PhpQuickProfiler;
5
6
class PhpQuickProfilerTest extends PHPUnit_Framework_TestCase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
{
8
9
    public function __construct()
10
    {
11
    }
12
13
    public function testConstruct()
14
    {
15
        $console = new Console();
16
        $startTime = microtime(true);
17
18
        $profiler = new PhpQuickProfiler($console, $startTime);
19
20
        $this->assertAttributeSame($console, 'console', $profiler);
21
        $this->assertAttributeEquals($startTime, 'startTime', $profiler);
22
    }
23
24
    public function testGetReadableTime()
25
    {
26
        $test_input = array(
27
            '.032432' => '32.432 ms',
28
            '24.3781' => '24.378 s',
29
            '145.123' => '2.419 m'
30
        );
31
32
        foreach ($test_input as $input => $expected_return) {
33
            $this->assertEquals($expected_return, PhpQuickProfiler::getReadableTime($input));
34
        }
35
    }
36
}
37