|
|
@@ -1731,11 +1731,11 @@ class QueryTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Tests whereNotInArray() and its input types.
|
|
|
+ * Tests whereNotInList() and its input types.
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testWhereNotInArray()
|
|
|
+ public function testWhereNotInList()
|
|
|
{
|
|
|
$this->loadFixtures('Articles');
|
|
|
$query = new Query($this->connection);
|
|
|
@@ -1754,11 +1754,11 @@ class QueryTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Tests whereNotInArray() and empty array input.
|
|
|
+ * Tests whereNotInList() and empty array input.
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testWhereNotInArrayEmpty()
|
|
|
+ public function testWhereNotInListEmpty()
|
|
|
{
|
|
|
$this->loadFixtures('Articles');
|
|
|
$query = new Query($this->connection);
|
|
|
@@ -1778,6 +1778,53 @@ class QueryTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Tests whereNotInListOrNull() and its input types.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testWhereNotInListOrNull()
|
|
|
+ {
|
|
|
+ $this->loadFixtures('Articles');
|
|
|
+ $query = new Query($this->connection);
|
|
|
+ $query->select(['id'])
|
|
|
+ ->from('articles')
|
|
|
+ ->whereNotInListOrNull('id', [1, 3]);
|
|
|
+
|
|
|
+ $this->assertQuotedQuery(
|
|
|
+ 'SELECT <id> FROM <articles> WHERE \\(<id> not in \\(:c0,:c1\\) OR \\(<id>\\) IS NULL\\)',
|
|
|
+ $query->sql(),
|
|
|
+ !$this->autoQuote
|
|
|
+ );
|
|
|
+
|
|
|
+ $result = $query->execute()->fetchAll('assoc');
|
|
|
+ $this->assertEquals(['id' => '2'], $result[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Tests whereNotInListOrNull() and empty array input.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testWhereNotInListOrNullEmpty()
|
|
|
+ {
|
|
|
+ $this->loadFixtures('Articles');
|
|
|
+ $query = new Query($this->connection);
|
|
|
+ $query->select(['id'])
|
|
|
+ ->from('articles')
|
|
|
+ ->whereNotInListOrNull('id', [], ['allowEmpty' => true])
|
|
|
+ ->order(['id']);
|
|
|
+
|
|
|
+ $this->assertQuotedQuery(
|
|
|
+ 'SELECT <id> FROM <articles> WHERE \(<id>\) IS NOT NULL',
|
|
|
+ $query->sql(),
|
|
|
+ !$this->autoQuote
|
|
|
+ );
|
|
|
+
|
|
|
+ $result = $query->execute()->fetchAll('assoc');
|
|
|
+ $this->assertEquals(['id' => '1'], $result[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Tests order() method both with simple fields and expressions
|
|
|
*
|
|
|
* @return void
|