Skip to content

Commit 6e826ff

Browse files
committed
adjust error code in tests
1 parent fbc337f commit 6e826ff

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@
22

33
## Release notes for the ArangoDB-PHP driver 3.7.x
44

5-
Work in progress.
5+
The corresponding ArangoDB version, ArangoDB 3.7 has dropped support for the MMFiles storage
6+
engine. Usage of the MMFiles storage engine is still supported in the 3.7 version of the PHP
7+
driver, in order to use the driver to connect to an ArangoDB 3.6.
8+
But MMFiles support will be dropped from the PHP driver in version 3.8.
9+
10+
Updating, replacing or removing documents in the database using a revision id guard value
11+
may return a different error message in case the revision id value of the found document is
12+
not as expected.
13+
14+
Previous versions returned HTTP error 412, an ArangoDB error code 1200 and an error message
15+
string "precondition failed". This version now returns the same error codes, but the error
16+
message string is changed to "conflict".
617

718

819
## Release notes for the ArangoDB-PHP driver 3.6.x

tests/DocumentExtendedTest.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,9 @@ public function testCreateUpdateGetAndDeleteDocumentWithRevisionCheck()
640640
}
641641

642642
static::assertInstanceOf(\Exception::class, $e);
643-
static::assertEquals('precondition failed', $e->getMessage());
643+
static::assertEquals(412, $e->getCode());
644+
static::assertEquals(1200, $e->getServerCode());
645+
static::assertEquals('conflict', $e->getMessage());
644646
$resultingDocument1 = $documentHandler->get($this->collection->getName(), $documentId);
645647

646648
static::assertEquals(
@@ -685,7 +687,9 @@ public function testCreateUpdateGetAndDeleteDocumentWithRevisionCheck()
685687
}
686688

687689
static::assertInstanceOf(\Exception::class, $e, 'Delete should have raised an exception here');
688-
static::assertEquals('precondition failed', $e->getMessage());
690+
static::assertEquals(412, $e->getCode());
691+
static::assertEquals(1200, $e->getServerCode());
692+
static::assertEquals('conflict', $e->getMessage());
689693
unset ($e);
690694

691695
$response = $documentHandler->remove($resultingDocument3, ['policy' => 'error']);
@@ -744,7 +748,9 @@ public function testMoreCreateUpdateGetAndDeleteDocumentWithRevisionCheck()
744748
}
745749

746750
static::assertInstanceOf(\Exception::class, $e);
747-
static::assertEquals('precondition failed', $e->getMessage());
751+
static::assertEquals(412, $e->getCode());
752+
static::assertEquals(1200, $e->getServerCode());
753+
static::assertEquals('conflict', $e->getMessage());
748754
$resultingDocument1 = $documentHandler->get($this->collection->getName(), $documentId);
749755

750756
static::assertEquals($resultingDocument1->someAttribute, 'someValue2');
@@ -789,7 +795,9 @@ public function testMoreCreateUpdateGetAndDeleteDocumentWithRevisionCheck()
789795
}
790796

791797
static::assertInstanceOf(\Exception::class, $e, 'Delete should have raised an exception here');
792-
static::assertEquals('precondition failed', $e->getMessage());
798+
static::assertEquals(412, $e->getCode());
799+
static::assertEquals(1200, $e->getServerCode());
800+
static::assertEquals('conflict', $e->getMessage());
793801
unset ($e);
794802

795803
$response = $documentHandler->remove($resultingDocument3, ['policy' => 'error']);
@@ -913,7 +921,9 @@ public function testCreateSetNullAttributeUpdateGetAndDeleteDocumentWithRevision
913921
}
914922

915923
static::assertInstanceOf(\Exception::class, $e, 'Delete should have raised an exception here');
916-
static::assertEquals('precondition failed', $e->getMessage());
924+
static::assertEquals(412, $e->getCode());
925+
static::assertEquals(1200, $e->getServerCode());
926+
static::assertEquals('conflict', $e->getMessage());
917927
unset ($e);
918928

919929
$response = $documentHandler->remove($resultingDocument3, ['policy' => 'error']);

0 commit comments

Comments
 (0)