| @@ 78-92 (lines=15) @@ | ||
| 75 | static::assertThat($condition, $this->isInstanceOf("Nip\Database\Query\Condition\Condition")); |
|
| 76 | } |
|
| 77 | ||
| 78 | public function testNested() |
|
| 79 | { |
|
| 80 | $this->selectQuery->from("table1"); |
|
| 81 | ||
| 82 | $query = $this->connection->newQuery(); |
|
| 83 | $query->from("table2"); |
|
| 84 | $query->where("id != 5"); |
|
| 85 | ||
| 86 | $this->selectQuery->where("id NOT IN ?", $query); |
|
| 87 | ||
| 88 | static::assertEquals( |
|
| 89 | "SELECT * FROM `table1` WHERE id NOT IN (SELECT * FROM `table2` WHERE id != 5)", |
|
| 90 | $this->selectQuery->assemble() |
|
| 91 | ); |
|
| 92 | } |
|
| 93 | ||
| 94 | public function testUnion() |
|
| 95 | { |
|
| @@ 94-104 (lines=11) @@ | ||
| 91 | ); |
|
| 92 | } |
|
| 93 | ||
| 94 | public function testUnion() |
|
| 95 | { |
|
| 96 | $this->selectQuery->from("table1"); |
|
| 97 | ||
| 98 | $query = $this->connection->newQuery(); |
|
| 99 | $query->from("table2"); |
|
| 100 | ||
| 101 | $union = $this->selectQuery->union($query); |
|
| 102 | ||
| 103 | static::assertEquals("SELECT * FROM `table1` UNION SELECT * FROM `table2`", $union->assemble()); |
|
| 104 | } |
|
| 105 | ||
| 106 | public function testHasPart() |
|
| 107 | { |
|