From 5969d92f2416db8630ea0e37902072a0edc16389 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 26 Feb 2026 08:09:58 +0200 Subject: [PATCH 1/3] Fail test --- phpunit.xml | 3 +- src/Database/Adapter/SQL.php | 4 ++- tests/e2e/Adapter/Base.php | 24 ++++++------- tests/e2e/Adapter/Scopes/DocumentTests.php | 40 ++++++++++++++++++++++ 4 files changed, 56 insertions(+), 15 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 2a0531cfd..7469c5341 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -7,8 +7,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false" -> + stopOnFailure="true"> ./tests/unit diff --git a/src/Database/Adapter/SQL.php b/src/Database/Adapter/SQL.php index fb949dfa4..a6ddaad88 100644 --- a/src/Database/Adapter/SQL.php +++ b/src/Database/Adapter/SQL.php @@ -3148,11 +3148,13 @@ public function find(Document $collection, array $queries = [], ?int $limit = 25 "; $sql = $this->trigger(Database::EVENT_DOCUMENT_FIND, $sql); - +var_dump($sql); try { $stmt = $this->getPDO()->prepare($sql); foreach ($binds as $key => $value) { + var_dump($key); + var_dump($value); if (gettype($value) === 'double') { $stmt->bindValue($key, $this->getFloatPrecision($value), \PDO::PARAM_STR); } else { diff --git a/tests/e2e/Adapter/Base.php b/tests/e2e/Adapter/Base.php index 4baeba35b..034191c23 100644 --- a/tests/e2e/Adapter/Base.php +++ b/tests/e2e/Adapter/Base.php @@ -23,19 +23,19 @@ abstract class Base extends TestCase { - use CollectionTests; - use CustomDocumentTypeTests; +// use CollectionTests; +// use CustomDocumentTypeTests; use DocumentTests; - use AttributeTests; - use IndexTests; - use OperatorTests; - use PermissionTests; - use RelationshipTests; - use SpatialTests; - use SchemalessTests; - use ObjectAttributeTests; - use VectorTests; - use GeneralTests; +// use AttributeTests; +// use IndexTests; +// use OperatorTests; +// use PermissionTests; +// use RelationshipTests; +// use SpatialTests; +// use SchemalessTests; +// use ObjectAttributeTests; +// use VectorTests; +// use GeneralTests; protected static string $namespace; diff --git a/tests/e2e/Adapter/Scopes/DocumentTests.php b/tests/e2e/Adapter/Scopes/DocumentTests.php index e79e9ccec..75d806d04 100644 --- a/tests/e2e/Adapter/Scopes/DocumentTests.php +++ b/tests/e2e/Adapter/Scopes/DocumentTests.php @@ -2177,6 +2177,46 @@ public function testFindFulltextSpecialChars(): void ]); $this->assertEquals(1, count($documents)); + + $phrases = [ + '+', // lone plus operator + '-', // lone minus operator + '~', // lone negation + '*', // wildcard alone + '"', // just a quote + '(', // opening paren + ')', // closing paren + '+(', // plus + unmatched paren + '-(', // minus + unmatched paren + '("', // unmatched paren + quote + '+("', // combination of +, paren, quote + ')+', // closing paren + operator + '""', // double quote alone + '(((', // multiple unmatched parens + ')))', // multiple unmatched closing parens + '+~', // plus + negation + '--', // double minus + '~~', // double negation + '+*', // plus + wildcard + '-*', // minus + wildcard + '+"test', // plus + unmatched quote + '"test', // unmatched quote + '"test\0', // unmatched quote + null byte + '+("test\0', // combination + unmatched quote + null byte + "\0", // null byte alone + "\x01", // control char 1 + "\x02", // control char 2 + "\x1f", // control char 31 + ]; + foreach ($phrases as $phrase) { + $documents = $database->find($collection, [ + Query::search('ft', $phrase), + ]); + } + + $this->assertEquals(12, 222); + + var_dump($documents); } public function testFindMultipleConditions(): void From 6ad0f4f6bdbe409f086d5cf3425827144a6ca56a Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 4 Mar 2026 13:28:02 +0200 Subject: [PATCH 2/3] test --- tests/e2e/Adapter/Scopes/DocumentTests.php | 36 ++-------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/tests/e2e/Adapter/Scopes/DocumentTests.php b/tests/e2e/Adapter/Scopes/DocumentTests.php index 75d806d04..dd4cbe588 100644 --- a/tests/e2e/Adapter/Scopes/DocumentTests.php +++ b/tests/e2e/Adapter/Scopes/DocumentTests.php @@ -2178,45 +2178,15 @@ public function testFindFulltextSpecialChars(): void $this->assertEquals(1, count($documents)); - $phrases = [ - '+', // lone plus operator - '-', // lone minus operator - '~', // lone negation - '*', // wildcard alone - '"', // just a quote - '(', // opening paren - ')', // closing paren - '+(', // plus + unmatched paren - '-(', // minus + unmatched paren - '("', // unmatched paren + quote - '+("', // combination of +, paren, quote - ')+', // closing paren + operator - '""', // double quote alone - '(((', // multiple unmatched parens - ')))', // multiple unmatched closing parens - '+~', // plus + negation - '--', // double minus - '~~', // double negation - '+*', // plus + wildcard - '-*', // minus + wildcard - '+"test', // plus + unmatched quote - '"test', // unmatched quote - '"test\0', // unmatched quote + null byte - '+("test\0', // combination + unmatched quote + null byte - "\0", // null byte alone - "\x01", // control char 1 - "\x02", // control char 2 - "\x1f", // control char 31 - ]; + $phrases = ["Álvaro"]; + foreach ($phrases as $phrase) { $documents = $database->find($collection, [ Query::search('ft', $phrase), ]); } - $this->assertEquals(12, 222); - - var_dump($documents); + $this->assertEquals(999, 999999); } public function testFindMultipleConditions(): void From 4950e5e88ba78cf7eadfa6b09152a82819f730f9 Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 4 Mar 2026 13:30:16 +0200 Subject: [PATCH 3/3] test --- tests/e2e/Adapter/Scopes/DocumentTests.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Adapter/Scopes/DocumentTests.php b/tests/e2e/Adapter/Scopes/DocumentTests.php index dd4cbe588..d173b98a3 100644 --- a/tests/e2e/Adapter/Scopes/DocumentTests.php +++ b/tests/e2e/Adapter/Scopes/DocumentTests.php @@ -2181,7 +2181,7 @@ public function testFindFulltextSpecialChars(): void $phrases = ["Álvaro"]; foreach ($phrases as $phrase) { - $documents = $database->find($collection, [ + $database->find($collection, [ Query::search('ft', $phrase), ]); }