diff --git a/tests/Unit/HasManyThroughTest.php b/tests/Unit/HasManyThroughTest.php index c6b5837..3228baa 100644 --- a/tests/Unit/HasManyThroughTest.php +++ b/tests/Unit/HasManyThroughTest.php @@ -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)); } @@ -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)); } @@ -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)); } @@ -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)); } @@ -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)); } @@ -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)); }