|
|
@@ -16,6 +16,7 @@ namespace Cake\Test\TestCase\ORM;
|
|
|
|
|
|
use ArrayObject;
|
|
|
use Cake\Core\Configure;
|
|
|
+use Cake\Core\Plugin;
|
|
|
use Cake\Database\Expression\OrderByExpression;
|
|
|
use Cake\Database\Expression\QueryExpression;
|
|
|
use Cake\Database\TypeMap;
|
|
|
@@ -520,6 +521,28 @@ class TableTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Should a dupicate short-named association be defined, the earlier
|
|
|
+ * association will be inaccessible via the __get method
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testHasManyPluginOverlap()
|
|
|
+ {
|
|
|
+ TableRegistry::get('Comments');
|
|
|
+ Plugin::load('TestPlugin');
|
|
|
+
|
|
|
+ $table = new Table(['table' => 'authors']);
|
|
|
+
|
|
|
+ $table->hasOne('Comments');
|
|
|
+ $comments = $table->Comments->target();
|
|
|
+ $this->assertInstanceOf('Cake\ORM\Table', $comments);
|
|
|
+
|
|
|
+ $table->hasMany('TestPlugin.Comments');
|
|
|
+ $comments = $table->Comments->target();
|
|
|
+ $this->assertInstanceOf('TestPlugin\Model\Table\CommentsTable', $comments);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Tests that BelongsToMany() creates and configures correctly the association
|
|
|
*
|
|
|
* @return void
|