Skip to content

Commit

Permalink
Using returnSelf instead
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Dec 19, 2013
1 parent 1d22687 commit eab3ec9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
18 changes: 9 additions & 9 deletions Cake/Test/TestCase/ORM/Association/BelongsToManyTest.php
Expand Up @@ -400,14 +400,14 @@ public function testEagerLoaderWithDefaults() {

$query->expects($this->at(0))->method('where')
->with(['Tags.name' => 'foo'])
->will($this->returnValue($query));
->will($this->returnSelf());
$query->expects($this->at(1))->method('where')
->with([])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->once())->method('order')
->with(['id' => 'ASC'])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->hydrate(false);

Expand Down Expand Up @@ -457,22 +457,22 @@ public function testEagerLoaderWithOverrides() {

$query->expects($this->at(0))->method('where')
->with(['Tags.name' => 'foo'])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->at(1))->method('where')
->with(['Tags.id !=' => 3])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->once())->method('order')
->with(['name' => 'DESC'])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->once())->method('select')
->with([
'Tags__name' => 'Tags.name',
'ArticlesTags__article_id' => 'ArticlesTags.article_id'
])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->hydrate(false);

Expand Down Expand Up @@ -574,11 +574,11 @@ public function testEagerLoaderSubquery() {

$query->expects($this->at(0))->method('where')
->with(['Tags.name' => 'foo'])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->at(1))->method('where')
->with([])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->once())->method('contain')
->with([
Expand Down
26 changes: 13 additions & 13 deletions Cake/Test/TestCase/ORM/Association/HasManyTest.php
Expand Up @@ -177,19 +177,19 @@ public function testEagerLoaderWithDefaults() {

$query->expects($this->at(0))->method('where')
->with(['Articles.is_active' => true])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->at(1))->method('where')
->with([])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->once())->method('andWhere')
->with(['Articles.author_id IN' => $keys])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->once())->method('order')
->with(['id' => 'ASC'])
->will($this->returnValue($query));
->will($this->returnSelf());

$association->eagerLoader(compact('keys', 'query'));
}
Expand Down Expand Up @@ -226,32 +226,32 @@ public function testEagerLoaderWithOverrides() {

$query->expects($this->at(0))->method('where')
->with(['Articles.is_active' => true])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->at(1))->method('where')
->with(['Articles.id !=' => 3])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->once())->method('andWhere')
->with(['Articles.author_id IN' => $keys])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->once())->method('order')
->with(['title' => 'DESC'])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->once())->method('select')
->with([
'Articles__title' => 'Articles.title',
'Articles__author_id' => 'Articles.author_id'
])
->will($this->returnValue($query));
->will($this->returnSelf());

$query->expects($this->once())->method('contain')
->with([
'Categories' => ['fields' => ['a', 'b']],
])
->will($this->returnValue($query));
->will($this->returnSelf());

$association->eagerLoader([
'conditions' => ['Articles.id !=' => 3],
Expand Down Expand Up @@ -326,10 +326,10 @@ public function testEagerLoaderSubquery() {

$query->expects($this->at(0))->method('where')
->with([])
->will($this->returnValue($query));
->will($this->returnSelf());
$query->expects($this->at(1))->method('where')
->with([])
->will($this->returnValue($query));
->will($this->returnSelf());

$expected = clone $parent;
$joins = $expected->join();
Expand All @@ -340,7 +340,7 @@ public function testEagerLoaderSubquery() {
->join($joins, [], true);
$query->expects($this->once())->method('andWhere')
->with(['Articles.author_id IN' => $expected])
->will($this->returnValue($query));
->will($this->returnSelf());

$callable = $association->eagerLoader([
'query' => $parent, 'strategy' => HasMany::STRATEGY_SUBQUERY, 'keys' => []
Expand Down

0 comments on commit eab3ec9

Please sign in to comment.