Skip to content

Commit

Permalink
Added test case
Browse files Browse the repository at this point in the history
  • Loading branch information
psaintjust committed Jul 10, 2016
1 parent 7edcdb0 commit b0e5e39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/Cake/Test/Case/Model/ModelIntegrationTest.php
Expand Up @@ -1617,10 +1617,12 @@ public function testAutoConstructAssociations() {
public function testAutoConstructPluginAssociations() {
$Comment = ClassRegistry::init('TestPluginComment');

$this->assertEquals(2, count($Comment->belongsTo), 'Too many associations');
$this->assertEquals(3, count($Comment->belongsTo), 'Too many associations');
$this->assertFalse(isset($Comment->belongsTo['TestPlugin.User']));
$this->assertFalse(isset($Comment->belongsTo['TestPlugin.Source']));
$this->assertTrue(isset($Comment->belongsTo['User']), 'Missing association');
$this->assertTrue(isset($Comment->belongsTo['TestPluginArticle']), 'Missing association');
$this->assertTrue(isset($Comment->belongsTo['Source']), 'Missing association');
}

/**
Expand Down
5 changes: 4 additions & 1 deletion lib/Cake/Test/Case/Model/models.php
Expand Up @@ -2991,7 +2991,10 @@ class TestPluginComment extends CakeTestModel {
'className' => 'TestPlugin.TestPluginArticle',
'foreignKey' => 'article_id',
),
'TestPlugin.User'
'TestPlugin.User',
'TestPlugin.Source' => array(
'foreignKey' => 'source_id'
)
);
}

Expand Down

0 comments on commit b0e5e39

Please sign in to comment.