| Conditions | 1 |
| Paths | 1 |
| Total Lines | 29 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | protected function setUp() |
||
| 29 | { |
||
| 30 | parent::setUp(); |
||
| 31 | |||
| 32 | $this->object = new HasOne(); |
||
| 33 | $this->object->setName('User'); |
||
| 34 | $this->object->addParams(['withPK' => 'id_custom']); |
||
| 35 | |||
| 36 | $this->_user = new Record(); |
||
|
|
|||
| 37 | |||
| 38 | $users = m::namedMock('Users', \Nip\Records\RecordManager::class)->makePartial(); |
||
| 39 | $users->setPrimaryKey('id'); |
||
| 40 | |||
| 41 | $users->shouldReceive('instance')->andReturnSelf(); |
||
| 42 | $users->shouldReceive('findByField') |
||
| 43 | ->withArgs(['id_user', 3]) |
||
| 44 | ->andReturn(new Collection([$this->_user])); |
||
| 45 | |||
| 46 | $this->object->setWith($users); |
||
| 47 | |||
| 48 | $articleManager = new RecordManager(); |
||
| 49 | $articleManager->setPrimaryKey('id'); |
||
| 50 | $articleManager->setPrimaryFK('id_user'); |
||
| 51 | |||
| 52 | $article = new Record(); |
||
| 53 | $article->id = 3; |
||
| 54 | $article->setManager($articleManager); |
||
| 55 | |||
| 56 | $this->object->setItem($article); |
||
| 57 | } |
||
| 59 |