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

RangeTest::testFactoryKnownRange()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
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
}