From c11de014849b49f1e6c8c1cd676f4a83cd7f5ae4 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Sun, 17 Jul 2022 23:26:10 +0200 Subject: [PATCH] Fix failing tests This tests started to fail with the 1.14 version of the driver --- docs/en/cookbook/validation-of-documents.rst | 4 ++-- docs/en/reference/annotations-reference.rst | 2 +- .../Doctrine/ODM/MongoDB/Tests/Functional/ValidationTest.php | 2 +- .../Doctrine/ODM/MongoDB/Tests/Mapping/ClassMetadataTest.php | 2 +- .../ODM/MongoDB/Tests/Mapping/Driver/XmlDriverTest.php | 2 +- .../xml/TestDocuments.SchemaValidatedDocument.dcm.xml | 2 +- tests/Doctrine/ODM/MongoDB/Tests/SchemaManagerTest.php | 4 ++-- tests/Documents/SchemaValidated.php | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/en/cookbook/validation-of-documents.rst b/docs/en/cookbook/validation-of-documents.rst index 0d43ed8060..6809ed824e 100644 --- a/docs/en/cookbook/validation-of-documents.rst +++ b/docs/en/cookbook/validation-of-documents.rst @@ -197,7 +197,7 @@ the ``odm:schema:create`` or ``odm:schema:update`` command. }, "$or": [ { "phone": { "$type": "string" } }, - { "email": { "$regex": { "$regularExpression" : { "pattern": "@mongodb\\.com$", "options": "" } } } }, + { "email": { "$regex": "@mongodb\\.com$" } }, { "status": { "$in": [ "Unknown", "Incomplete" ] } } ] } @@ -241,7 +241,7 @@ the ``odm:schema:create`` or ``odm:schema:update`` command. }, "$or": [ { "phone": { "$type": "string" } }, - { "email": { "$regex": { "$regularExpression" : { "pattern": "@mongodb\\.com$", "options": "" } } } }, + { "email": { "$regex": "@mongodb\\.com$" } }, { "status": { "$in": [ "Unknown", "Incomplete" ] } } ] } diff --git a/docs/en/reference/annotations-reference.rst b/docs/en/reference/annotations-reference.rst index 72b8a3834d..a4f7c2e28b 100644 --- a/docs/en/reference/annotations-reference.rst +++ b/docs/en/reference/annotations-reference.rst @@ -1186,7 +1186,7 @@ for the related collection. }, "$or": [ { "phone": { "$type": "string" } }, - { "email": { "$regex": { "$regularExpression" : { "pattern": "@mongodb\\.com$", "options": "" } } } }, + { "email": { "$regex": "@mongodb\\.com$" } }, { "status": { "$in": [ "Unknown", "Incomplete" ] } } ] } diff --git a/tests/Doctrine/ODM/MongoDB/Tests/Functional/ValidationTest.php b/tests/Doctrine/ODM/MongoDB/Tests/Functional/ValidationTest.php index a8c64a4e18..871a0d2760 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/Functional/ValidationTest.php +++ b/tests/Doctrine/ODM/MongoDB/Tests/Functional/ValidationTest.php @@ -36,7 +36,7 @@ public function testCreateUpdateValidatedDocument(): void }, "$or": [ { "phone": { "$type": "string" } }, - { "email": { "$regex": { "$regularExpression" : { "pattern": "@mongodb\\.com$", "options": "" } } } }, + { "email": { "$regex": "@mongodb\\.com$" } }, { "status": { "$in": [ "Unknown", "Incomplete" ] } } ] } diff --git a/tests/Doctrine/ODM/MongoDB/Tests/Mapping/ClassMetadataTest.php b/tests/Doctrine/ODM/MongoDB/Tests/Mapping/ClassMetadataTest.php index 9a5ad1b933..6bd2426e67 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/ODM/MongoDB/Tests/Mapping/ClassMetadataTest.php @@ -77,7 +77,7 @@ public function testClassMetadataInstanceSerialization(): void $cm->setLockField('lock'); $cm->setVersioned(true); $cm->setVersionField('version'); - $validatorJson = '{ "$and": [ { "email": { "$regex": { "$regularExpression" : { "pattern": "@mongodb\\\\.com$", "options": "" } } } } ] }'; + $validatorJson = '{ "$and": [ { "email": { "$regex": "@mongodb\\\\.com$" } } ] }'; $cm->setValidator(toPHP(fromJSON($validatorJson))); $cm->setValidationAction(ClassMetadata::SCHEMA_VALIDATION_ACTION_WARN); $cm->setValidationLevel(ClassMetadata::SCHEMA_VALIDATION_LEVEL_OFF); diff --git a/tests/Doctrine/ODM/MongoDB/Tests/Mapping/Driver/XmlDriverTest.php b/tests/Doctrine/ODM/MongoDB/Tests/Mapping/Driver/XmlDriverTest.php index 88cfc0a846..2d7c3f76af 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/Mapping/Driver/XmlDriverTest.php +++ b/tests/Doctrine/ODM/MongoDB/Tests/Mapping/Driver/XmlDriverTest.php @@ -132,7 +132,7 @@ public function testValidationMapping(): void }, "$or": [ { "phone": { "$type": "string" } }, - { "email": { "$regex": { "$regularExpression" : { "pattern": "@mongodb\\.com$", "options": "" } } } }, + { "email": { "$regex": "@mongodb\\.com$" } }, { "status": { "$in": [ "Unknown", "Incomplete" ] } } ] } diff --git a/tests/Doctrine/ODM/MongoDB/Tests/Mapping/Driver/fixtures/xml/TestDocuments.SchemaValidatedDocument.dcm.xml b/tests/Doctrine/ODM/MongoDB/Tests/Mapping/Driver/fixtures/xml/TestDocuments.SchemaValidatedDocument.dcm.xml index a29e53043a..5079b02c10 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/Mapping/Driver/fixtures/xml/TestDocuments.SchemaValidatedDocument.dcm.xml +++ b/tests/Doctrine/ODM/MongoDB/Tests/Mapping/Driver/fixtures/xml/TestDocuments.SchemaValidatedDocument.dcm.xml @@ -18,7 +18,7 @@ }, "$or": [ { "phone": { "$type": "string" } }, - { "email": { "$regex": { "$regularExpression" : { "pattern": "@mongodb\\.com$", "options": "" } } } }, + { "email": { "$regex": "@mongodb\\.com$" } }, { "status": { "$in": [ "Unknown", "Incomplete" ] } } ] } diff --git a/tests/Doctrine/ODM/MongoDB/Tests/SchemaManagerTest.php b/tests/Doctrine/ODM/MongoDB/Tests/SchemaManagerTest.php index ab3141fe1a..71e31a7f23 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/SchemaManagerTest.php +++ b/tests/Doctrine/ODM/MongoDB/Tests/SchemaManagerTest.php @@ -430,7 +430,7 @@ public function testUpdateDocumentValidator(array $expectedWriteOptions, ?int $m }, "$or": [ { "phone": { "$type": "string" } }, - { "email": { "$regex": { "$regularExpression" : { "pattern": "@mongodb\\.com$", "options": "" } } } }, + { "email": { "$regex": "@mongodb\\.com$" } }, { "status": { "$in": [ "Unknown", "Incomplete" ] } } ] } @@ -543,7 +543,7 @@ public function testCreateDocumentCollectionWithValidator(array $expectedWriteOp }, "$or": [ { "phone": { "$type": "string" } }, - { "email": { "$regex": { "$regularExpression" : { "pattern": "@mongodb\\.com$", "options": "" } } } }, + { "email": { "$regex": "@mongodb\\.com$" } }, { "status": { "$in": [ "Unknown", "Incomplete" ] } } ] } diff --git a/tests/Documents/SchemaValidated.php b/tests/Documents/SchemaValidated.php index 16ab4afd03..c90d9dd069 100644 --- a/tests/Documents/SchemaValidated.php +++ b/tests/Documents/SchemaValidated.php @@ -30,7 +30,7 @@ class SchemaValidated }, "$or": [ { "phone": { "$type": "string" } }, - { "email": { "$regex": { "$regularExpression" : { "pattern": "@mongodb\\.com$", "options": "" } } } }, + { "email": { "$regex": "@mongodb\\.com$" } }, { "status": { "$in": [ "Unknown", "Incomplete" ] } } ] }