Completed
Push — master ( 096858...7ec34d )
by Gabriel
03:50
created

HasUuidRecordManagerTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 21
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_bootHasUuidRecordManagerTrait() 0 8 1
A test_creating_notOverwrite() 0 9 1
1
<?php
2
3
namespace Nip\Records\Tests\Traits\HasUuid;
4
5
use Nip\Records\Tests\AbstractTest;
6
use Nip\Records\Tests\Fixtures\Records\Books\Books;
7
8
/**
9
 * Class HasUuidRecordManagerTrait
10
 * @package Nip\Records\Tests\Traits\HasUuid
11
 */
12
class HasUuidRecordManagerTrait extends AbstractTest
13
{
14
    public function test_bootHasUuidRecordManagerTrait()
15
    {
16
        $books = Books::instance();
17
        $book = $books->getNew();
18
        $book->insert();
19
20
        self::assertNotEmpty($book->uuid);
0 ignored issues
show
Bug Best Practice introduced by
The property uuid does not exist on Nip\Records\Record. Since you implemented __get, consider adding a @property annotation.
Loading history...
21
        self::assertSame(36, strlen($book->uuid));
22
    }
23
24
    public function test_creating_notOverwrite()
25
    {
26
        $books = Books::instance();
27
        $book = $books->getNew();
28
        $book->uuid = '3c21852c-9b93-4cba-a86f-2e507f2ca5d6';
0 ignored issues
show
Bug Best Practice introduced by
The property uuid does not exist on Nip\Records\Record. Since you implemented __set, consider adding a @property annotation.
Loading history...
29
        $book->insert();
30
31
        self::assertNotEmpty($book->uuid);
0 ignored issues
show
Bug Best Practice introduced by
The property uuid does not exist on Nip\Records\Record. Since you implemented __get, consider adding a @property annotation.
Loading history...
32
        self::assertSame('3c21852c-9b93-4cba-a86f-2e507f2ca5d6', $book->uuid);
33
    }
34
}