Completed
Push — master ( 2f6da3...fdf5fc )
by Jacob
02:08
created

DisplayTest::testGetReadableTime()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 12
Ratio 100 %
Metric Value
dl 12
loc 12
rs 9.4286
cc 2
eloc 7
nc 2
nop 0
1
<?php
2
3
use Particletree\Pqp\Display;
4
5
class DisplayTest 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...
6
{
7
8 View Code Duplication
    public function testGetReadableTime()
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
    {
10
        $test_input = array(
11
            '.032432' => '32.432 ms',
12
            '24.3781' => '24.378 s',
13
            '145.123' => '2.419 m'
14
        );
15
16
        foreach ($test_input as $input => $expected_return) {
17
            $this->assertEquals($expected_return, Display::getReadableTime($input));
18
        }
19
    }
20
21
    public function testGetReadableMemory()
22
    {
23
        $test_input = array(
24
            '314'     => '314 b',
25
            '7403'    => '7.23 k',
26
            '2589983' => '2.47 M'
27
        );
28
29
        foreach ($test_input as $input => $expected_return) {
30
            $this->assertEquals($expected_return, Display::getReadableMemory($input));
31
        }
32
    }
33
}
34