Completed
Branch trunk (78000f)
by SuperNova.WS
25:55 queued 09:00
created

ToolsTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 2
1
<?php
2
3
/**
4
 * Created by Gorlum 01.03.2017 14:03
5
 */
6
7
/**
8
 * Class ToolsTest
9
 *
10
 * @coversDefaultClass Tools
11
 */
12
class ToolsTest extends PHPUnit_Framework_TestCase {
13
  public function setUp() {
14
    parent::setUp();
15
  }
16
17
  public function tearDown() {
18
    parent::tearDown();
19
  }
20
21
  public function dataFillPercentStyle() {
22
    return array(
23
      array(100, 101, 'error'),
24
      array(100, 100, 'warning'),
25
      array(100, 99, 'warning'),
26
      array(100, 91, 'warning'),
27
      array(100, 90, 'notice'),
28
      array(100, 89, 'notice'),
29
      array(100, 76, 'notice'),
30
      array(100, 75, 'info'),
31
      array(100, 74, 'info'),
32
      array(100, 51, 'info'),
33
      array(100, 50, 'ok'),
34
      array(100, 49, 'ok'),
35
      array(100, 0, 'ok'),
36
37
      array(0, 1, 'error'),
38
      array(0, 0, 'zero_number'),
39
      array(0, -1, 'zero_number'),
40
    );
41
  }
42
43
  /**
44
   * Test for style select in fillPercentStyle
45
   *
46
   * @covers ::fillPercentStyle
47
   * @dataProvider dataFillPercentStyle
48
   */
49
  public function testFillPercentStyle($number, $sample, $expected) {
50
    $this->assertEquals($expected, Tools::fillPercentStyle($number, $sample));
51
  }
52
53
  /**
54
   * Test for span-wrapping of fillPercentStyle
55
   *
56
   * @covers ::numberPercentSpan
57
   */
58
  public function testNumberStyleSpan() {
59
    $this->assertEquals("<span class=\"ok\">100</span>", Tools::numberPercentSpan(100, 10));
60
  }
61
62
}
63