Passed
Push — master ( 9e1161...5545f1 )
by Kirill
03:21
created

LimitsTraitTest::testOffset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Tests\Pagination;
13
14
use PHPUnit\Framework\TestCase;
15
use Spiral\Pagination\Traits\LimitsTrait;
16
17
/**
18
 * Class LimitTraitTest
19
 *
20
 * @package Spiral\Tests\Pagination\Traits
21
 */
22
class LimitsTraitTest extends TestCase
23
{
24
    public const DEFAULT_LIMIT = 0;
25
    public const DEFAULT_OFFSET = 0;
26
    public const LIMIT = 10;
27
    public const OFFSET = 15;
28
29
    /**
30
     * @var LimitsTrait
31
     */
32
    private $trait;
33
34
    public function setUp(): void
35
    {
36
        $this->trait = $this->getMockForTrait(LimitsTrait::class);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockForTrait(S...its\LimitsTrait::class) of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type Spiral\Pagination\Traits\LimitsTrait of property $trait.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
37
    }
38
39
    public function testLimit()
40
    {
41
        $this->assertEquals(static::DEFAULT_LIMIT, $this->trait->getLimit());
42
        $this->assertEquals($this->trait, $this->trait->limit(static::LIMIT));
43
        $this->assertEquals(static::LIMIT, $this->trait->getLimit());
44
    }
45
46
    public function testOffset()
47
    {
48
        $this->assertEquals(static::DEFAULT_OFFSET, $this->trait->getOffset());
49
        $this->assertEquals($this->trait, $this->trait->offset(static::OFFSET));
50
        $this->assertEquals(static::OFFSET, $this->trait->getOffset());
51
    }
52
}
53