Passed
Push — master ( 99f763...812350 )
by Gabriel
04:23
created

HasAttributesRecordTraitTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_field_append() 0 15 1
1
<?php
2
3
namespace Nip\Records\Tests\Traits\HasAttributes;
4
5
use Nip\Records\Tests\Fixtures\Records\Books\Book;
6
7
/**
8
 * Class HasAttributesRecordTraitTest
9
 * @package Nip\Records\Tests\Traits\HasAttributes
10
 */
11
class HasAttributesRecordTraitTest extends \Nip\Records\Tests\AbstractTest
12
{
13
    public function test_field_append()
14
    {
15
        $book = new Book();
16
        self::assertNull($book->field);
0 ignored issues
show
Bug Best Practice introduced by
The property field does not exist on Nip\Records\Tests\Fixtures\Records\Books\Book. Since you implemented __get, consider adding a @property annotation.
Loading history...
17
18
        $book->field = [];
0 ignored issues
show
Bug Best Practice introduced by
The property field does not exist on Nip\Records\Tests\Fixtures\Records\Books\Book. Since you implemented __set, consider adding a @property annotation.
Loading history...
19
        self::assertIsArray($book->field);
20
21
        $book->field = '99';
22
        $book->field .= '99';
23
        self::assertSame('9999', $book->field);
24
25
        $book->field = 10;
26
        $book->field += 10;
27
        self::assertSame(20, $book->field);
28
    }
29
}