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

test_getDirty_with_fields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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