Skip to content

Commit

Permalink
Add explicit test for #3425
Browse files Browse the repository at this point in the history
Ensure the association name does not take the class name
  • Loading branch information
AD7six committed Feb 14, 2015
1 parent 9bae44e commit 67410cd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/TestCase/ORM/TableTest.php
Expand Up @@ -497,6 +497,25 @@ public function testHasOne()
$this->assertSame($table, $hasOne->source());
}

/**
* Test has one with a plugin model
*
* @return void
*/
public function testHasOnePlugin()
{
$options = ['className' => 'TestPlugin.Comments'];
$table = new Table(['table' => 'users']);

$hasOne = $table->hasOne('Comments', $options);
$this->assertInstanceOf('Cake\ORM\Association\HasOne', $hasOne);
$this->assertSame('Comments', $hasOne->name());

$hasOneTable = $hasOne->target();
$this->assertSame('Comments', $hasOne->alias());
$this->assertSame('TestPlugin.Comments', $hasOne->registryAlias());
}

/**
* Tests that hasMany() creates and configures correctly the association
*
Expand Down

0 comments on commit 67410cd

Please sign in to comment.