HasAttributesRecordTraitTest::test_field_append()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

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