| Total Complexity | 4 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | class AccessorsTest extends TestCase |
||
| 18 | { |
||
| 19 | public function testAccessed(): void |
||
| 20 | { |
||
| 21 | $e = new AccessedEntity(); |
||
| 22 | $e->name = 'antony'; |
||
|
|
|||
| 23 | $this->assertSame('ANTONY', (string)$e->name); |
||
| 24 | |||
| 25 | $e->setFields(['name' => 'bob']); |
||
| 26 | $this->assertSame('BOB', (string)$e->name); |
||
| 27 | |||
| 28 | $this->assertSame([ |
||
| 29 | 'name' => 'BOB' |
||
| 30 | ], $e->getValue()); |
||
| 31 | |||
| 32 | $this->assertSame([ |
||
| 33 | 'name' => 'BOB' |
||
| 34 | ], $e->jsonSerialize()); |
||
| 35 | |||
| 36 | $this->assertEquals([ |
||
| 37 | 'name' => new NameValue('bob') |
||
| 38 | ], $e->getFields()); |
||
| 39 | |||
| 40 | $e->name = new NameValue('mike'); |
||
| 41 | |||
| 42 | $this->assertEquals([ |
||
| 43 | 'name' => new NameValue('mike') |
||
| 44 | ], $e->getFields()); |
||
| 45 | } |
||
| 46 | |||
| 47 | public function testGetAccessor(): void |
||
| 58 | } |
||
| 59 | |||
| 60 | public function testReflection(): void |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @expectedException \Spiral\Models\Exception\EntityException |
||
| 70 | */ |
||
| 71 | public function testException(): void |
||
| 77 |