diff --git a/src/Traits/ValidatesExpressions.php b/src/Traits/ValidatesExpressions.php index bb45e7e..edf12fb 100644 --- a/src/Traits/ValidatesExpressions.php +++ b/src/Traits/ValidatesExpressions.php @@ -165,7 +165,7 @@ public function isBindParameter(string $bindParameter): bool public function isAssociativeArray(array $array): bool { if (empty($array)) { - return true; + return false; } return !ctype_digit(implode('', array_keys($array))); diff --git a/tests/Unit/AQL/QueryClausesTest.php b/tests/Unit/AQL/QueryClausesTest.php index 2706c55..383a68a 100644 --- a/tests/Unit/AQL/QueryClausesTest.php +++ b/tests/Unit/AQL/QueryClausesTest.php @@ -74,7 +74,8 @@ public function testForClauseInExpression() ) ) ->get(); - self::assertEquals('LET x = [1,2,3,4] FOR u IN (1 > 0) ? x : {}', $aqb->query); + + self::assertEquals('LET x = [1,2,3,4] FOR u IN (1 > 0) ? x : []', $aqb->query); } public function testFilterClause() diff --git a/tests/Unit/AQL/StatementClausesTest.php b/tests/Unit/AQL/StatementClausesTest.php index 54ff8ce..8abe338 100644 --- a/tests/Unit/AQL/StatementClausesTest.php +++ b/tests/Unit/AQL/StatementClausesTest.php @@ -78,13 +78,16 @@ public function testInsertStatement() public function testInsertEmptyArrayStatement() { - $result = (new QueryBuilder())->insert('{ - "traits": [] - }', 'Characters')->get(); + $characterData = [ + "tags" => [] + ]; + + $result = (new QueryBuilder())->insert($characterData, 'Characters')->get(); - self::assertEquals('{ - "traits": [] - }', $result->binds[$result->getQueryId() . '_1']); + self::assertEquals( + 'INSERT {"tags":[]} IN Characters', + $result->query + ); } diff --git a/tests/Unit/GrammarTest.php b/tests/Unit/GrammarTest.php index 6dfa890..4dd41b5 100644 --- a/tests/Unit/GrammarTest.php +++ b/tests/Unit/GrammarTest.php @@ -405,7 +405,7 @@ public function testIsAssociativeArray() ]; $result = $this->grammar->isAssociativeArray($emptyArray); - self::assertTrue($result); + self::assertFalse($result); $result = $this->grammar->isAssociativeArray($associativeArray); self::assertTrue($result);