Completed
Push — master ( 932683...ea80b7 )
by Jacob
04:03
created

DisplayTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetReadableTime() 0 12 2
A testGetReadableMemory() 0 12 2
1
<?php
2
3
namespace Particletree\Pqp;
4
5
use PHPUnit_Framework_TestCase;
6
7
class DisplayTest extends PHPUnit_Framework_TestCase
8
{
9
10
    public function testGetReadableTime()
11
    {
12
        $test_input = array(
13
            '.032432' => '32.432 ms',
14
            '24.3781' => '24.378 s',
15
            '145.123' => '2.419 m'
16
        );
17
18
        foreach ($test_input as $input => $expected_return) {
19
            $this->assertEquals($expected_return, Display::getReadableTime($input));
20
        }
21
    }
22
23
    public function testGetReadableMemory()
24
    {
25
        $test_input = array(
26
            '314'     => '314 b',
27
            '7403'    => '7.23 k',
28
            '2589983' => '2.47 M'
29
        );
30
31
        foreach ($test_input as $input => $expected_return) {
32
            $this->assertEquals($expected_return, Display::getReadableMemory($input));
33
        }
34
    }
35
}
36