File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 16
16
17
17
use ArrayObject ;
18
18
use Cake \Core \Configure ;
19
+ use Cake \Core \Plugin ;
19
20
use Cake \Database \Expression \OrderByExpression ;
20
21
use Cake \Database \Expression \QueryExpression ;
21
22
use Cake \Database \TypeMap ;
@@ -519,6 +520,28 @@ public function testHasMany()
519
520
$ this ->assertSame ($ table , $ hasMany ->source ());
520
521
}
521
522
523
+ /**
524
+ * Should a dupicate short-named association be defined, the earlier
525
+ * association will be inaccessible via the __get method
526
+ *
527
+ * @return void
528
+ */
529
+ public function testHasManyPluginOverlap ()
530
+ {
531
+ TableRegistry::get ('Comments ' );
532
+ Plugin::load ('TestPlugin ' );
533
+
534
+ $ table = new Table (['table ' => 'authors ' ]);
535
+
536
+ $ table ->hasOne ('Comments ' );
537
+ $ comments = $ table ->Comments ->target ();
538
+ $ this ->assertInstanceOf ('Cake\ORM\Table ' , $ comments );
539
+
540
+ $ table ->hasMany ('TestPlugin.Comments ' );
541
+ $ comments = $ table ->Comments ->target ();
542
+ $ this ->assertInstanceOf ('TestPlugin\Model\Table\CommentsTable ' , $ comments );
543
+ }
544
+
522
545
/**
523
546
* Tests that BelongsToMany() creates and configures correctly the association
524
547
*
You can’t perform that action at this time.
0 commit comments