|
|
@@ -592,6 +592,22 @@ class QueryTest extends TestCase {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Tests that passing an empty array type to any where condition will not
|
|
|
+ * result in an error, but in an empty result set
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testSelectWhereArrayTypeEmpty() {
|
|
|
+ $query = new Query($this->connection);
|
|
|
+ $result = $query
|
|
|
+ ->select(['id'])
|
|
|
+ ->from('comments')
|
|
|
+ ->where(['id' => []], ['id' => 'integer[]'])
|
|
|
+ ->execute();
|
|
|
+ $this->assertCount(0, $result);
|
|
|
+ }
|
|
|
+
|
|
|
+/**
|
|
|
* Tests that Query::orWhere() can be used to concatenate conditions with OR
|
|
|
*
|
|
|
* @return void
|
|
|
@@ -2678,6 +2694,29 @@ class QueryTest extends TestCase {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Tests that using the IS operator will automatically translate to the best
|
|
|
+ * possible operator depending on the passed value
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testDirectIsNull() {
|
|
|
+ $sql = (new Query($this->connection))
|
|
|
+ ->select(['name'])
|
|
|
+ ->from(['authors'])
|
|
|
+ ->where(['name IS' => null])
|
|
|
+ ->sql();
|
|
|
+ $this->assertQuotedQuery('WHERE \(<name>\) IS NULL', $sql, true);
|
|
|
+
|
|
|
+ $results = (new Query($this->connection))
|
|
|
+ ->select(['name'])
|
|
|
+ ->from(['authors'])
|
|
|
+ ->where(['name IS' => 'larry'])
|
|
|
+ ->execute();
|
|
|
+ $this->assertCount(1, $results);
|
|
|
+ $this->assertEquals(['name' => 'larry'], $results->fetch('assoc'));
|
|
|
+ }
|
|
|
+
|
|
|
+/**
|
|
|
* Assertion for comparing a table's contents with what is in it.
|
|
|
*
|
|
|
* @param string $table
|