Passed
Pull Request — master (#20)
by
unknown
07:25
created

VariablesTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 22
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetDateTime() 0 5 1
A testGetReservationLength() 0 5 1
A testGetReservationLengthAfterSet() 0 7 1
1
<?php namespace VojtaSvoboda\Reservations\Tests\Variables;
2
3
use PluginTestCase;
4
use VojtaSvoboda\Reservations\Classes\Variables;
5
use VojtaSvoboda\Reservations\Models\Settings;
6
7
class VariablesTest extends PluginTestCase
8
{
9
    public function testGetDateTime()
10
    {
11
        $result = Variables::getDateTimeFormat();
12
        $this->assertSame('d/m/Y H:i', $result);
13
    }
14
15
    public function testGetReservationLength()
16
    {
17
        $result = Variables::getReservationLength();
18
        $this->assertSame('2 hours', $result);
19
    }
20
21
    public function testGetReservationLengthAfterSet()
22
    {
23
        Settings::set('reservation_length', 90);
24
        Settings::set('reservation_length_unit', 'minutes');
25
        $result = Variables::getReservationLength();
26
        $this->assertSame('90 minutes', $result);
27
    }
28
}
29