Passed
Branch feature/v2 (61dd95)
by Valentin
05:53
created

RangeTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 35
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testFactoryUnknownRange() 0 5 1
A testFactoryKnownRange() 0 7 1
A testSupportedRange() 0 7 1
1
<?php
2
3
namespace Spiral\Tests\Statistics\Extract;
4
5
use Spiral\Statistics\Extract\Range;
6
use Spiral\Statistics\Extract\RangeInterface;
7
use Spiral\Tests\BaseTest;
8
9
class RangeTest extends BaseTest
10
{
11
    /**
12
     * Test unsupported range interval
13
     *
14
     * @expectedException \Spiral\Statistics\Exceptions\InvalidExtractRangeException
15
     */
16
    public function testFactoryUnknownRange()
17
    {
18
        $factory = new Range\Factory();
19
        $factory->getRange('some-range');
20
    }
21
22
    /**
23
     * Test unsupported range interval
24
     */
25
    public function testFactoryKnownRange()
26
    {
27
        $factory = new Range\Factory();
28
        $range = $factory->getRange(RangeInterface::DAILY);
29
30
        $this->assertInstanceOf(Range\DailyRange::class, $range);
31
    }
32
33
    /**
34
     * Test supported range interval
35
     */
36
    public function testSupportedRange()
37
    {
38
        $range = new Range\DailyRange();
39
        $this->assertEquals($range->getRange(), RangeInterface::DAILY);
40
        $this->assertNotEmpty($range->getFormat());
41
        $this->assertNotEmpty($range->getInterval());
42
    }
43
}