Skip to content

Commit

Permalink
Better example test
Browse files Browse the repository at this point in the history
  • Loading branch information
AD7six committed Feb 10, 2015
1 parent 9d1e8a3 commit 07cde44
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions tests/TestCase/ORM/TableTest.php
Expand Up @@ -521,8 +521,7 @@ public function testHasMany()
}

/**
* Should a dupicate short-named association be defined, the earlier
* association will be inaccessible via the __get method
* Ensure associations use the plugin-prefixed model
*
* @return void
*/
Expand All @@ -533,11 +532,25 @@ public function testHasManyPluginOverlap()

$table = new Table(['table' => 'authors']);

$table->hasOne('Comments');
$table->hasMany('TestPlugin.Comments');
$comments = $table->Comments->target();
$this->assertInstanceOf('Cake\ORM\Table', $comments);
$this->assertInstanceOf('TestPlugin\Model\Table\CommentsTable', $comments);
}

$table->hasMany('TestPlugin.Comments');
/**
* Ensure associations use the plugin-prefixed model
* even if specified with config
*
* @return void
*/
public function testHasManyPluginOverlapConfig()
{
TableRegistry::get('Comments');
Plugin::load('TestPlugin');

$table = new Table(['table' => 'authors']);

$table->hasMany('Comments', ['className' => 'TestPlugin.Comments']);
$comments = $table->Comments->target();
$this->assertInstanceOf('TestPlugin\Model\Table\CommentsTable', $comments);
}
Expand Down

0 comments on commit 07cde44

Please sign in to comment.