Skip to content

Commit

Permalink
Fixing some failing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Sep 15, 2013
1 parent 6a93360 commit f0bb2f5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
13 changes: 8 additions & 5 deletions lib/Cake/Test/TestCase/ORM/Association/BelongsToManyTest.php
Expand Up @@ -282,7 +282,7 @@ public function testEagerLoader() {
])
->will($this->returnSelf());

$callable = $association->eagerLoader(compact('keys'));
$callable = $association->eagerLoader(compact('keys', 'query'));
$row = ['Article__id' => 1, 'title' => 'article 1'];
$result = $callable($row);
$row['Tag__Tag'] = [
Expand Down Expand Up @@ -347,7 +347,7 @@ public function testEagerLoaderWithDefaults() {
->with(['id' => 'ASC'])
->will($this->returnValue($query));

$association->eagerLoader(compact('keys'));
$association->eagerLoader(compact('keys', 'query'));
}

/**
Expand Down Expand Up @@ -413,7 +413,8 @@ public function testEagerLoaderWithOverrides() {
'conditions' => ['Tag.id !=' => 3],
'sort' => ['name' => 'DESC'],
'fields' => ['name', 'ArticleTag.article_id'],
'keys' => $keys
'keys' => $keys,
'query' => $query
]);
}

Expand Down Expand Up @@ -450,7 +451,8 @@ public function testEagerLoaderFieldsException() {

$association->eagerLoader([
'keys' => $keys,
'fields' => ['name']
'fields' => ['name'],
'query' => $query
]);
}

Expand Down Expand Up @@ -519,7 +521,8 @@ public function testEagerLoaderSubquery() {
->will($this->returnSelf());

$callable = $association->eagerLoader([
'query' => $parent, 'strategy' => BelongsToMany::STRATEGY_SUBQUERY
'query' => $parent, 'strategy' => BelongsToMany::STRATEGY_SUBQUERY,
'keys' => []
]);

$row['Tag__Tag'] = [
Expand Down
15 changes: 10 additions & 5 deletions lib/Cake/Test/TestCase/ORM/Association/HasManyTest.php
Expand Up @@ -118,7 +118,7 @@ public function testEagerLoader() {
$query->expects($this->once())->method('execute')
->will($this->returnValue($results));

$callable = $association->eagerLoader(compact('keys'));
$callable = $association->eagerLoader(compact('keys', 'query'));
$row = ['Author__id' => 1, 'username' => 'author 1'];
$result = $callable($row);
$row['Article__Article'] = [
Expand Down Expand Up @@ -176,7 +176,7 @@ public function testEagerLoaderWithDefaults() {
->with(['id' => 'ASC'])
->will($this->returnValue($query));

$association->eagerLoader(compact('keys'));
$association->eagerLoader(compact('keys', 'query'));
}

/**
Expand Down Expand Up @@ -239,7 +239,8 @@ public function testEagerLoaderWithOverrides() {
'sort' => ['title' => 'DESC'],
'fields' => ['title', 'author_id'],
'contain' => ['Category' => ['fields' => ['a', 'b']]],
'keys' => $keys
'keys' => $keys,
'query' => $query
]);
}

Expand Down Expand Up @@ -267,7 +268,11 @@ public function testEagerLoaderFieldsException() {
$this->article->expects($this->once())->method('find')->with('all')
->will($this->returnValue($query));

$association->eagerLoader(['fields' => ['id', 'title'], 'keys' => $keys]);
$association->eagerLoader([
'fields' => ['id', 'title'],
'keys' => $keys,
'query' => $query
]);
}

/**
Expand Down Expand Up @@ -316,7 +321,7 @@ public function testEagerLoaderSubquery() {
->will($this->returnValue($query));

$callable = $association->eagerLoader([
'query' => $parent, 'strategy' => HasMany::STRATEGY_SUBQUERY
'query' => $parent, 'strategy' => HasMany::STRATEGY_SUBQUERY, 'keys' => []
]);
$row = ['Author__id' => 1, 'username' => 'author 1'];
$result = $callable($row);
Expand Down

0 comments on commit f0bb2f5

Please sign in to comment.