File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,9 @@ class AuthorsFixture extends TestFixture
29
29
* @var array
30
30
*/
31
31
public $ fields = [
32
- 'id ' => ['type ' => 'integer ' ],
32
+ 'author_id ' => ['type ' => 'integer ' ],
33
33
'name ' => ['type ' => 'string ' , 'default ' => null ],
34
- '_constraints ' => ['primary ' => ['type ' => 'primary ' , 'columns ' => ['id ' ]]]
34
+ '_constraints ' => ['primary ' => ['type ' => 'primary ' , 'columns ' => ['author_id ' ]]]
35
35
];
36
36
37
37
/**
Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ public function setUp(): void
46
46
47
47
$ this ->connection = ConnectionManager::get ('test ' );
48
48
49
+ $ this ->Authors = $ this ->getTableLocator ()->get ('Authors ' );
50
+ $ this ->Authors ->setPrimaryKey ('author_id ' );
51
+
49
52
$ this ->Articles = $ this ->getTableLocator ()->get ('Articles ' );
50
53
$ this ->Articles ->setEntityClass (LazyLoadableEntity::class);
51
54
$ this ->Articles ->belongsTo ('Authors ' );
@@ -313,7 +316,7 @@ public function testGetLazyLoadsOnce()
313
316
314
317
$ author = $ comment ->author ;
315
318
316
- $ this ->assertEquals (2 , $ author ->id );
319
+ $ this ->assertEquals (2 , $ author ->author_id );
317
320
318
321
// ensure it is grabbed from _properties and not lazy loaded again (which calls repository())
319
322
$ comment ->author ;
@@ -375,7 +378,7 @@ public function testEmptySource()
375
378
$ comment = new Comment (['id ' => 1 , 'user_id ' => 2 ]);
376
379
$ author = $ comment ->author ;
377
380
378
- $ this ->assertEquals (2 , $ author ->id );
381
+ $ this ->assertEquals (2 , $ author ->author_id );
379
382
}
380
383
381
384
/**
You can’t perform that action at this time.
0 commit comments