-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows serializing
union()
from Query Builder instance (#10)
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,4 +48,20 @@ public function it_can_serialize_a_basic_query_builder_with_wheres() | |
|
||
$this->assertSame($builder->toSql(), $unserialize->toSql()); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_serialize_a_basic_query_builder_with_unions() | ||
{ | ||
$builder = DB::table('users')->where('email', '=', '[email protected]'); | ||
$union = DB::table('users')->where('email', '=', '[email protected]') | ||
->union($builder); | ||
|
||
$serialized = serialize($union); | ||
|
||
$unserialize = unserialize($serialized); | ||
|
||
$this->assertSame('select * from (select * from "users" where "email" = ?) union select * from (select * from "users" where "email" = ?)', $unserialize->toSql()); | ||
|
||
$this->assertSame($union->toSql(), $unserialize->toSql()); | ||
} | ||
} |