BookingClassesTest   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 34
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testTodayReturnsCurrentDayClassWithBooking() 0 4 1
A testAnyOtherDayReturnsNothingWithBooking() 0 4 1
A testTodayReturnsCurrentDayClassAndNoBooking() 0 4 1
A testPreviousDayReturnsNoPastBooking() 0 4 1
A testFutureDayReturnsNoFutureBooking() 0 4 1
1
<?php
2
3
namespace JhFlexiTimeTest\View\Helper;
4
5
use JhFlexiTime\View\Helper\BookingClasses;
6
7
/**
8
 * Class BookingClassesTest
9
 * @package JhFlexiTimeTest\View\Helper
10
 * @author Aydin Hassan <[email protected]>
11
 */
12
class BookingClassesTest extends \PHPUnit_Framework_TestCase
13
{
14
    protected $helper;
15
16
    public function setUp()
17
    {
18
        $this->helper = new BookingClasses();
19
    }
20
21
    public function testTodayReturnsCurrentDayClassWithBooking()
22
    {
23
        $this->assertEquals('today', $this->helper->__invoke(new \DateTime("today"), true));
24
    }
25
26
    public function testAnyOtherDayReturnsNothingWithBooking()
27
    {
28
        $this->assertEquals('', $this->helper->__invoke(new \DateTime("yesterday"), true));
29
    }
30
31
    public function testTodayReturnsCurrentDayClassAndNoBooking()
32
    {
33
        $this->assertEquals('today no-booking', $this->helper->__invoke(new \DateTime("today"), false));
34
    }
35
36
    public function testPreviousDayReturnsNoPastBooking()
37
    {
38
        $this->assertEquals('no-booking no-booking-past', $this->helper->__invoke(new \DateTime("yesterday"), false));
39
    }
40
41
    public function testFutureDayReturnsNoFutureBooking()
42
    {
43
        $this->assertEquals('no-booking no-booking-future', $this->helper->__invoke(new \DateTime("tomorrow"), false));
44
    }
45
}
46