AutoIncrementIdTests::testToNative()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 13
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 13
loc 13
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace Cubiche\Domain\Identity\Tests\Units;
12
13
use Cubiche\Domain\Identity\AutoIncrementId;
14
use Cubiche\Domain\Identity\Id;
15
use Cubiche\Domain\Model\IdInterface;
16
use Cubiche\Tests\TestCase;
17
18
/**
19
 * AutoIncrementIdTests class.
20
 *
21
 * @author Ivannis Suárez Jerez <[email protected]>
22
 */
23 View Code Duplication
class AutoIncrementIdTests extends TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
{
25
    /**
26
     * Test class.
27
     */
28
    public function testClass()
29
    {
30
        $this
31
            ->testedClass
32
                ->extends(Id::class)
33
                ->implements(IdInterface::class)
34
        ;
35
    }
36
37
    /**
38
     * Test toNative method.
39
     */
40
    public function testToNative()
41
    {
42
        $this
43
            ->given($id = AutoIncrementId::fromNative(10))
44
            ->then
45
                ->integer($id->toNative())->isEqualTo(10)
46
                ->exception(
47
                    function () {
48
                        AutoIncrementId::fromNative('some-string');
49
                    }
50
                )->isInstanceOf(\InvalidArgumentException::class)
51
        ;
52
    }
53
}
54