Skip to content
Permalink
Browse files

Using returnSelf instead

  • Loading branch information...
lorenzo committed Dec 19, 2013
1 parent 1d22687 commit eab3ec93cbce6ce9f4fa6c82bbda75d50d441de7
@@ -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);
@@ -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);
@@ -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([
@@ -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'));
}
@@ -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],
@@ -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();
@@ -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' => []

0 comments on commit eab3ec9

Please sign in to comment.
You can’t perform that action at this time.