File tree Expand file tree Collapse file tree 4 files changed +30
-6
lines changed Expand file tree Collapse file tree 4 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -659,18 +659,24 @@ public function truncate($collection)
659
659
* @throws Exception
660
660
*
661
661
* @param mixed $collection - collection id as string or number or collection object
662
+ * @param array $options - an array of options for the drop operation
662
663
*
663
664
* @return bool - always true, will throw if there is an error
664
665
*/
665
- public function drop ($ collection )
666
+ public function drop ($ collection, $ options = array () )
666
667
{
667
668
$ collectionName = $ this ->getCollectionName ($ collection );
668
669
669
670
if ($ this ->isValidCollectionId ($ collectionName )) {
670
671
throw new ClientException ('Cannot alter a collection without a collection id ' );
671
672
}
672
673
673
- $ this ->getConnection ()->delete (UrlHelper::buildUrl (Urls::URL_COLLECTION , [$ collectionName ]));
674
+ $ appendix = '' ;
675
+ if (is_array ($ options ) && isset ($ options ['isSystem ' ])) {
676
+ $ appendix = '?isSystem= ' . UrlHelper::getBoolString ($ options ['isSystem ' ]);
677
+ }
678
+
679
+ $ this ->getConnection ()->delete (UrlHelper::buildUrl (Urls::URL_COLLECTION , [$ collectionName ]) . $ appendix );
674
680
675
681
return true ;
676
682
}
Original file line number Diff line number Diff line change @@ -428,7 +428,7 @@ public function testCreateAndDeleteSystemCollectionWithoutCreatingObject()
428
428
$ name = '_ArangoDB_PHP_TestSuite_TestCollection_02 ' ;
429
429
430
430
try {
431
- $ collectionHandler ->drop ($ name );
431
+ $ collectionHandler ->drop ($ name, [ ' isSystem ' => true ] );
432
432
} catch (Exception $ e ) {
433
433
//Silence the exception
434
434
}
@@ -447,7 +447,7 @@ public function testCreateAndDeleteSystemCollectionWithoutCreatingObject()
447
447
static ::assertTrue ($ resultingCollectionProperties ->getWaitForSync ());
448
448
449
449
450
- $ collectionHandler ->delete ($ name );
450
+ $ collectionHandler ->drop ($ name, [ ' isSystem ' => true ] );
451
451
}
452
452
453
453
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public function setUp()
33
33
$ this ->documentHandler = new DocumentHandler ($ this ->connection );
34
34
35
35
try {
36
- $ this ->collectionHandler ->delete ('ArangoDB_PHP_TestSuite_TestCollection_01 ' );
36
+ $ this ->collectionHandler ->drop ('ArangoDB_PHP_TestSuite_TestCollection_01 ' );
37
37
} catch (\Exception $ e ) {
38
38
// don't bother us, if it's already deleted.
39
39
}
@@ -112,6 +112,11 @@ public function testCreateGetAndDeleteSystemCollection()
112
112
$ collection ->setName ($ name );
113
113
$ collection ->setIsSystem (true );
114
114
115
+ try {
116
+ $ collectionHandler ->drop ($ name , [ 'isSystem ' => true ]);
117
+ } catch (Exception $ e ) {
118
+ //Silence the exception
119
+ }
115
120
116
121
$ response = $ collectionHandler ->add ($ collection );
117
122
@@ -122,7 +127,7 @@ public function testCreateGetAndDeleteSystemCollection()
122
127
$ properties = $ collectionHandler ->getProperties ($ name );
123
128
static ::assertTrue ($ properties ->getIsSystem (), '"isSystem" should be true! ' );
124
129
125
- $ response = $ collectionHandler ->delete ($ collection );
130
+ $ response = $ collectionHandler ->drop ($ collection, [ ' isSystem ' => true ] );
126
131
static ::assertTrue ($ response , 'Delete should return true! ' );
127
132
}
128
133
Original file line number Diff line number Diff line change @@ -31,6 +31,19 @@ public function setUp()
31
31
$ this ->collection = new Collection ();
32
32
$ this ->collection ->setName ('ArangoDB_PHP_TestSuite_TestEdgeCollection_01 ' );
33
33
$ this ->collectionHandler ->add ($ this ->collection );
34
+
35
+ try {
36
+ $ this ->collectionHandler ->drop ('ArangoDB_PHP_TestSuite_EdgeCollection_01 ' );
37
+ } catch (Exception $ e ) {
38
+ //Silence the exception
39
+ }
40
+
41
+ try {
42
+ $ this ->collectionHandler ->drop ('ArangoDB_PHP_TestSuite_Collection_01 ' );
43
+ } catch (Exception $ e ) {
44
+ //Silence the exception
45
+ }
46
+
34
47
$ this ->edgeHandler = new EdgeHandler ($ this ->connection );
35
48
$ this ->edgeCollection = new Collection ();
36
49
$ this ->edgeCollection ->setName ('ArangoDBPHPTestSuiteTestEdgeCollection01 ' );
You can’t perform that action at this time.
0 commit comments