Skip to content

Commit

Permalink
- Removed unused conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
tylernathanreed committed Feb 9, 2022
1 parent 36e32c3 commit 01c6100
Showing 1 changed file with 6 additions and 33 deletions.
39 changes: 6 additions & 33 deletions tests/Unit/HasManyThroughTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,7 @@ public function circular_alias_softDeletes(Closure $query, string $builderClass)
$builder = $query(new EloquentSoftDeletingUserModelStub)
->joinRelation('employeePosts as employees,posts');

if ($this->isVersionAfter('7.10.0')) {
$this->assertEquals('select * from "users" inner join "users" as "employees" on "employees"."manager_id" = "users"."id" and "employees"."deleted_at" is null inner join "posts" on "posts"."user_id" = "employees"."id" where "users"."deleted_at" is null', $builder->toSql());
} else {
$this->assertEquals('select * from "users" inner join "users" as "employees" on "employees"."manager_id" = "users"."id" and "employees"."deleted_at" is null inner join "posts" on "posts"."user_id" = "employees"."id" and "users"."deleted_at" is null where "users"."deleted_at" is null', $builder->toSql());
}
$this->assertEquals('select * from "users" inner join "users" as "employees" on "employees"."manager_id" = "users"."id" and "employees"."deleted_at" is null inner join "posts" on "posts"."user_id" = "employees"."id" where "users"."deleted_at" is null', $builder->toSql());
$this->assertEquals($builderClass, get_class($builder));
}

Expand All @@ -194,11 +190,7 @@ public function throughCircular_alias_softDeletes(Closure $query, string $builde
$builder = $query(new EloquentUserModelStub)
->joinRelation('employeesThroughSoftDeletingDepartment as employees');

if ($this->isVersionAfter('7.10.0')) {
$this->assertEquals('select * from "users" inner join "departments" on "departments"."supervisor_id" = "users"."id" and "departments"."deleted_at" is null inner join "users" as "employees" on "employees"."department_id" = "departments"."id"', $builder->toSql());
} else {
$this->assertEquals('select * from "users" inner join "departments" on "departments"."supervisor_id" = "users"."id" and "departments"."deleted_at" is null inner join "users" as "employees" on "employees"."department_id" = "departments"."id" and "departments"."deleted_at" is null', $builder->toSql());
}
$this->assertEquals('select * from "users" inner join "departments" on "departments"."supervisor_id" = "users"."id" and "departments"."deleted_at" is null inner join "users" as "employees" on "employees"."department_id" = "departments"."id"', $builder->toSql());
$this->assertEquals($builderClass, get_class($builder));
}

Expand Down Expand Up @@ -286,11 +278,7 @@ public function constraints_pivot_softDeletes(Closure $query, string $builderCla
$through->active();
});

if ($this->isVersionAfter('7.10.0')) {
$this->assertEquals('select * from "countries" inner join "users" on "users"."country_id" = "countries"."id" and "active" = ? and "users"."deleted_at" is null inner join "posts" on "posts"."user_id" = "users"."id"', $builder->toSql());
} else {
$this->assertEquals('select * from "countries" inner join "users" on "users"."country_id" = "countries"."id" and "active" = ? and "users"."deleted_at" is null inner join "posts" on "posts"."user_id" = "users"."id" and "users"."deleted_at" is null', $builder->toSql());
}
$this->assertEquals('select * from "countries" inner join "users" on "users"."country_id" = "countries"."id" and "active" = ? and "users"."deleted_at" is null inner join "posts" on "posts"."user_id" = "users"."id"', $builder->toSql());
$this->assertEquals([true], $builder->getBindings());
$this->assertEquals($builderClass, get_class($builder));
}
Expand All @@ -306,12 +294,7 @@ public function constraints_pivot_softDeletes_withTrashed(Closure $query, string
$through->withTrashed();
});

if ($this->isVersionAfter('7.10.0')) {
$this->assertEquals('select * from "countries" inner join "users" on "users"."country_id" = "countries"."id" inner join "posts" on "posts"."user_id" = "users"."id"', $builder->toSql());
} else {
$this->assertEquals('select * from "countries" inner join "users" on "users"."country_id" = "countries"."id" inner join "posts" on "posts"."user_id" = "users"."id" and "users"."deleted_at" is null', $builder->toSql());
}

$this->assertEquals('select * from "countries" inner join "users" on "users"."country_id" = "countries"."id" inner join "posts" on "posts"."user_id" = "users"."id"', $builder->toSql());
$this->assertEquals($builderClass, get_class($builder));
}

Expand All @@ -324,12 +307,7 @@ public function constraints_pivot_softDeletes_alias(Closure $query, string $buil
$builder = $query(new EloquentCountryModelStub)
->joinRelation('postsThroughSoftDeletingUser as citizens,articles');

if ($this->isVersionAfter('7.10.0')) {
$this->assertEquals('select * from "countries" inner join "users" as "citizens" on "citizens"."country_id" = "countries"."id" and "citizens"."deleted_at" is null inner join "posts" as "articles" on "articles"."user_id" = "citizens"."id"', $builder->toSql());
} else {
$this->assertEquals('select * from "countries" inner join "users" as "citizens" on "citizens"."country_id" = "countries"."id" and "citizens"."deleted_at" is null inner join "posts" as "articles" on "articles"."user_id" = "citizens"."id" and "users"."deleted_at" is null', $builder->toSql());
}

$this->assertEquals('select * from "countries" inner join "users" as "citizens" on "citizens"."country_id" = "countries"."id" and "citizens"."deleted_at" is null inner join "posts" as "articles" on "articles"."user_id" = "citizens"."id"', $builder->toSql());
$this->assertEquals($builderClass, get_class($builder));
}

Expand All @@ -344,12 +322,7 @@ public function constraints_pivot_softDeletes_withTrashed_alias(Closure $query,
$through->withTrashed();
});

if ($this->isVersionAfter('7.10.0')) {
$this->assertEquals('select * from "countries" inner join "users" as "citizens" on "citizens"."country_id" = "countries"."id" inner join "posts" as "articles" on "articles"."user_id" = "citizens"."id"', $builder->toSql());
} else {
$this->assertEquals('select * from "countries" inner join "users" as "citizens" on "citizens"."country_id" = "countries"."id" inner join "posts" as "articles" on "articles"."user_id" = "citizens"."id" and "users"."deleted_at" is null', $builder->toSql());
}

$this->assertEquals('select * from "countries" inner join "users" as "citizens" on "citizens"."country_id" = "countries"."id" inner join "posts" as "articles" on "articles"."user_id" = "citizens"."id"', $builder->toSql());
$this->assertEquals($builderClass, get_class($builder));
}

Expand Down

0 comments on commit 01c6100

Please sign in to comment.