Passed
Push — main ( 2621a4...7e0081 )
by Gabriel
02:32
created

TrackOriginalTraitTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_getDirty_with_empty_array() 0 7 1
A test_getDirty_with_fields() 0 7 1
1
<?php
2
3
namespace ByTIC\DataObjects\Tests\Behaviors\TrackOriginal;
4
5
use ByTIC\DataObjects\Tests\AbstractTest;
6
use ByTIC\DataObjects\Tests\Fixtures\Models\Books\Book;
7
8
/**
9
 * Class TrackOriginalTraitTest
10
 * @package ByTIC\DataObjects\Tests\Behaviors\TrackOriginal
11
 */
12
class TrackOriginalTraitTest extends AbstractTest
13
{
14
    public function test_getDirty_with_empty_array()
15
    {
16
        $book = new Book();
17
        $book->name = 'name1';
0 ignored issues
show
Bug Best Practice introduced by
The property $name is declared protected in ByTIC\DataObjects\Tests\Fixtures\Models\Books\Book. Since you implement __set, consider adding a @property or @property-write.
Loading history...
18
        $book->title = 'title1';
0 ignored issues
show
Bug Best Practice introduced by
The property $title is declared protected in ByTIC\DataObjects\Tests\Fixtures\Models\Books\Book. Since you implement __set, consider adding a @property or @property-write.
Loading history...
19
20
        self::assertSame(['name' => 'Name1', 'title' => 'title1'], $book->getDirty());
21
    }
22
    public function test_getDirty_with_fields()
23
    {
24
        $book = new Book();
25
        $book->name = 'name1';
0 ignored issues
show
Bug Best Practice introduced by
The property $name is declared protected in ByTIC\DataObjects\Tests\Fixtures\Models\Books\Book. Since you implement __set, consider adding a @property or @property-write.
Loading history...
26
        $book->title = 'title1';
0 ignored issues
show
Bug Best Practice introduced by
The property $title is declared protected in ByTIC\DataObjects\Tests\Fixtures\Models\Books\Book. Since you implement __set, consider adding a @property or @property-write.
Loading history...
27
28
        self::assertSame(['name' => 'Name1'], $book->getDirty(['name']));
29
    }
30
}
31