From a3738cf4e133a4475c56b51f521a12db78e2ecbb Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 11 Nov 2018 08:07:04 -0600 Subject: [PATCH] formatting --- src/Illuminate/Database/Eloquent/Relations/Relation.php | 2 +- src/Illuminate/Database/Query/Builder.php | 2 +- tests/Database/DatabaseEloquentBelongsToTest.php | 8 ++++---- tests/Database/DatabaseEloquentHasManyTest.php | 2 +- tests/Database/DatabaseEloquentHasOneTest.php | 2 +- tests/Database/DatabaseEloquentMorphTest.php | 2 +- tests/Database/DatabaseEloquentMorphToManyTest.php | 2 +- tests/Database/DatabaseQueryBuilderTest.php | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Relations/Relation.php b/src/Illuminate/Database/Eloquent/Relations/Relation.php index b2882a5a3a0f..e16ade9981a9 100755 --- a/src/Illuminate/Database/Eloquent/Relations/Relation.php +++ b/src/Illuminate/Database/Eloquent/Relations/Relation.php @@ -318,7 +318,7 @@ protected function whereInMethod(Model $model, $key) { return $model->getKeyName() === last(explode('.', $key)) && in_array($model->getKeyType(), ['int', 'integer']) - ? 'whereInRawInt' + ? 'whereIntegerInRaw' : 'whereIn'; } diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index 4189e169ae31..3ad96bb06e31 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -957,7 +957,7 @@ protected function whereInExistingQuery($column, $query, $boolean, $not) * @param bool $not * @return $this */ - public function whereInRawInt($column, $values, $boolean = 'and', $not = false) + public function whereIntegerInRaw($column, $values, $boolean = 'and', $not = false) { $type = $not ? 'NotInRaw' : 'InRaw'; diff --git a/tests/Database/DatabaseEloquentBelongsToTest.php b/tests/Database/DatabaseEloquentBelongsToTest.php index 77efba013a34..5f92c683ca09 100755 --- a/tests/Database/DatabaseEloquentBelongsToTest.php +++ b/tests/Database/DatabaseEloquentBelongsToTest.php @@ -81,7 +81,7 @@ public function testEagerConstraintsAreProperlyAdded() $relation = $this->getRelation(); $relation->getRelated()->shouldReceive('getKeyName')->andReturn('id'); $relation->getRelated()->shouldReceive('getKeyType')->andReturn('int'); - $relation->getQuery()->shouldReceive('whereInRawInt')->once()->with('relation.id', ['foreign.value', 'foreign.value.two']); + $relation->getQuery()->shouldReceive('whereIntegerInRaw')->once()->with('relation.id', ['foreign.value', 'foreign.value.two']); $models = [new EloquentBelongsToModelStub, new EloquentBelongsToModelStub, new AnotherEloquentBelongsToModelStub]; $relation->addEagerConstraints($models); } @@ -91,7 +91,7 @@ public function testIdsInEagerConstraintsCanBeZero() $relation = $this->getRelation(); $relation->getRelated()->shouldReceive('getKeyName')->andReturn('id'); $relation->getRelated()->shouldReceive('getKeyType')->andReturn('int'); - $relation->getQuery()->shouldReceive('whereInRawInt')->once()->with('relation.id', ['foreign.value', 0]); + $relation->getQuery()->shouldReceive('whereIntegerInRaw')->once()->with('relation.id', ['foreign.value', 0]); $models = [new EloquentBelongsToModelStub, new EloquentBelongsToModelStubWithZeroId]; $relation->addEagerConstraints($models); } @@ -160,7 +160,7 @@ public function testDefaultEagerConstraintsWhenIncrementing() $relation = $this->getRelation(); $relation->getRelated()->shouldReceive('getKeyName')->andReturn('id'); $relation->getRelated()->shouldReceive('getKeyType')->andReturn('int'); - $relation->getQuery()->shouldReceive('whereInRawInt')->once()->with('relation.id', m::mustBe([null])); + $relation->getQuery()->shouldReceive('whereIntegerInRaw')->once()->with('relation.id', m::mustBe([null])); $models = [new MissingEloquentBelongsToModelStub, new MissingEloquentBelongsToModelStub]; $relation->addEagerConstraints($models); } @@ -178,7 +178,7 @@ public function testDefaultEagerConstraintsWhenNotIncrementing() $relation = $this->getRelation(null, false); $relation->getRelated()->shouldReceive('getKeyName')->andReturn('id'); $relation->getRelated()->shouldReceive('getKeyType')->andReturn('int'); - $relation->getQuery()->shouldReceive('whereInRawInt')->once()->with('relation.id', m::mustBe([null])); + $relation->getQuery()->shouldReceive('whereIntegerInRaw')->once()->with('relation.id', m::mustBe([null])); $models = [new MissingEloquentBelongsToModelStub, new MissingEloquentBelongsToModelStub]; $relation->addEagerConstraints($models); } diff --git a/tests/Database/DatabaseEloquentHasManyTest.php b/tests/Database/DatabaseEloquentHasManyTest.php index 0f922e895179..96fd019cb137 100755 --- a/tests/Database/DatabaseEloquentHasManyTest.php +++ b/tests/Database/DatabaseEloquentHasManyTest.php @@ -202,7 +202,7 @@ public function testEagerConstraintsAreProperlyAdded() $relation = $this->getRelation(); $relation->getParent()->shouldReceive('getKeyName')->once()->andReturn('id'); $relation->getParent()->shouldReceive('getKeyType')->once()->andReturn('int'); - $relation->getQuery()->shouldReceive('whereInRawInt')->once()->with('table.foreign_key', [1, 2]); + $relation->getQuery()->shouldReceive('whereIntegerInRaw')->once()->with('table.foreign_key', [1, 2]); $model1 = new EloquentHasManyModelStub; $model1->id = 1; $model2 = new EloquentHasManyModelStub; diff --git a/tests/Database/DatabaseEloquentHasOneTest.php b/tests/Database/DatabaseEloquentHasOneTest.php index f60b42b83d42..3238058c9641 100755 --- a/tests/Database/DatabaseEloquentHasOneTest.php +++ b/tests/Database/DatabaseEloquentHasOneTest.php @@ -165,7 +165,7 @@ public function testEagerConstraintsAreProperlyAdded() $relation = $this->getRelation(); $relation->getParent()->shouldReceive('getKeyName')->once()->andReturn('id'); $relation->getParent()->shouldReceive('getKeyType')->once()->andReturn('int'); - $relation->getQuery()->shouldReceive('whereInRawInt')->once()->with('table.foreign_key', [1, 2]); + $relation->getQuery()->shouldReceive('whereIntegerInRaw')->once()->with('table.foreign_key', [1, 2]); $model1 = new EloquentHasOneModelStub; $model1->id = 1; $model2 = new EloquentHasOneModelStub; diff --git a/tests/Database/DatabaseEloquentMorphTest.php b/tests/Database/DatabaseEloquentMorphTest.php index 18bcc81436cf..02517ec3a48f 100755 --- a/tests/Database/DatabaseEloquentMorphTest.php +++ b/tests/Database/DatabaseEloquentMorphTest.php @@ -54,7 +54,7 @@ public function testMorphManyEagerConstraintsAreProperlyAdded() $relation = $this->getManyRelation(); $relation->getParent()->shouldReceive('getKeyName')->once()->andReturn('id'); $relation->getParent()->shouldReceive('getKeyType')->once()->andReturn('int'); - $relation->getQuery()->shouldReceive('whereInRawInt')->once()->with('table.morph_id', [1, 2]); + $relation->getQuery()->shouldReceive('whereIntegerInRaw')->once()->with('table.morph_id', [1, 2]); $relation->getQuery()->shouldReceive('where')->once()->with('table.morph_type', get_class($relation->getParent())); $model1 = new EloquentMorphResetModelStub; diff --git a/tests/Database/DatabaseEloquentMorphToManyTest.php b/tests/Database/DatabaseEloquentMorphToManyTest.php index 6a481b08422c..af60b5167a2a 100644 --- a/tests/Database/DatabaseEloquentMorphToManyTest.php +++ b/tests/Database/DatabaseEloquentMorphToManyTest.php @@ -20,7 +20,7 @@ public function testEagerConstraintsAreProperlyAdded() $relation = $this->getRelation(); $relation->getParent()->shouldReceive('getKeyName')->andReturn('id'); $relation->getParent()->shouldReceive('getKeyType')->andReturn('int'); - $relation->getQuery()->shouldReceive('whereInRawInt')->once()->with('taggables.taggable_id', [1, 2]); + $relation->getQuery()->shouldReceive('whereIntegerInRaw')->once()->with('taggables.taggable_id', [1, 2]); $relation->getQuery()->shouldReceive('where')->once()->with('taggables.taggable_type', get_class($relation->getParent())); $model1 = new EloquentMorphToManyModelStub; $model1->id = 1; diff --git a/tests/Database/DatabaseQueryBuilderTest.php b/tests/Database/DatabaseQueryBuilderTest.php index 4fd235088a54..c3e9f3b77f90 100755 --- a/tests/Database/DatabaseQueryBuilderTest.php +++ b/tests/Database/DatabaseQueryBuilderTest.php @@ -693,10 +693,10 @@ public function testEmptyWhereNotIns() $this->assertEquals([0 => 1], $builder->getBindings()); } - public function testWhereInRawInt() + public function testwhereIntegerInRaw() { $builder = $this->getBuilder(); - $builder->select('*')->from('users')->whereInRawInt('id', ['1a', 2]); + $builder->select('*')->from('users')->whereIntegerInRaw('id', ['1a', 2]); $this->assertEquals('select * from "users" where "id" in (1, 2)', $builder->toSql()); $this->assertEquals([], $builder->getBindings()); }