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