Skip to content

Commit

Permalink
Improving tests for BelongsTo
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed May 12, 2013
1 parent e4c8668 commit a778589
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/ORM/Association/BelongsTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function attachTo(Query $query, array $options = []) {
if (!empty($options['foreignKey'])) {
$options['conditions'][] = sprintf('%s.%s = %s.%s',
$target->alias(),
$source->primaryKey(),
$target->primaryKey(),
$source->alias(),
$options['foreignKey']
);
Expand Down
3 changes: 1 addition & 2 deletions lib/Cake/Test/TestCase/ORM/Association/BelongsToTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function testAttachTo() {

/**
* Tests that default config defined in the association can be overridden
*
*
* @return void
*/
public function testAttachToConfigOverride() {
Expand Down Expand Up @@ -132,7 +132,6 @@ public function testAttachToConfigOverride() {
public function testAttachToNoFields() {
$query = $this->getMock('\Cake\ORM\Query', ['join', 'select'], [null]);
$config = [
'foreignKey' => 'company_id',
'sourceTable' => $this->client,
'targetTable' => $this->company,
'conditions' => ['Company.is_active' => true]
Expand Down

0 comments on commit a778589

Please sign in to comment.