@@ -20,7 +20,7 @@ trait SchemalessTests
2020 public function testSchemalessDocumentOperation (): void
2121 {
2222 /** @var Database $database */
23- $ database = static :: getDatabase ();
23+ $ database = $ this -> getDatabase ();
2424
2525 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
2626 $ this ->expectNotToPerformAssertions ();
@@ -117,7 +117,7 @@ public function testSchemalessDocumentOperation(): void
117117 public function testSchemalessDocumentInvalidInteralAttributeValidation (): void
118118 {
119119 /** @var Database $database */
120- $ database = static :: getDatabase ();
120+ $ database = $ this -> getDatabase ();
121121
122122 // test to ensure internal attributes are checked during creating schemaless document
123123 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
@@ -156,7 +156,7 @@ public function testSchemalessDocumentInvalidInteralAttributeValidation(): void
156156 public function testSchemalessSelectionOnUnknownAttributes (): void
157157 {
158158 /** @var Database $database */
159- $ database = static :: getDatabase ();
159+ $ database = $ this -> getDatabase ();
160160
161161 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
162162 $ this ->expectNotToPerformAssertions ();
@@ -203,7 +203,7 @@ public function testSchemalessSelectionOnUnknownAttributes(): void
203203 public function testSchemalessIncrement (): void
204204 {
205205 /** @var Database $database */
206- $ database = static :: getDatabase ();
206+ $ database = $ this -> getDatabase ();
207207
208208 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
209209 $ this ->expectNotToPerformAssertions ();
@@ -257,7 +257,7 @@ public function testSchemalessIncrement(): void
257257 public function testSchemalessDecrement (): void
258258 {
259259 /** @var Database $database */
260- $ database = static :: getDatabase ();
260+ $ database = $ this -> getDatabase ();
261261
262262 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
263263 $ this ->expectNotToPerformAssertions ();
@@ -311,7 +311,7 @@ public function testSchemalessDecrement(): void
311311 public function testSchemalessUpdateDocumentWithQuery (): void
312312 {
313313 /** @var Database $database */
314- $ database = static :: getDatabase ();
314+ $ database = $ this -> getDatabase ();
315315
316316 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
317317 $ this ->expectNotToPerformAssertions ();
@@ -369,7 +369,7 @@ public function testSchemalessUpdateDocumentWithQuery(): void
369369 public function testSchemalessDeleteDocumentWithQuery (): void
370370 {
371371 /** @var Database $database */
372- $ database = static :: getDatabase ();
372+ $ database = $ this -> getDatabase ();
373373
374374 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
375375 $ this ->expectNotToPerformAssertions ();
@@ -412,7 +412,7 @@ public function testSchemalessDeleteDocumentWithQuery(): void
412412 public function testSchemalessUpdateDocumentsWithQuery (): void
413413 {
414414 /** @var Database $database */
415- $ database = static :: getDatabase ();
415+ $ database = $ this -> getDatabase ();
416416
417417 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
418418 $ this ->expectNotToPerformAssertions ();
@@ -507,7 +507,7 @@ public function testSchemalessUpdateDocumentsWithQuery(): void
507507 public function testSchemalessDeleteDocumentsWithQuery (): void
508508 {
509509 /** @var Database $database */
510- $ database = static :: getDatabase ();
510+ $ database = $ this -> getDatabase ();
511511
512512 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
513513 $ this ->expectNotToPerformAssertions ();
@@ -589,7 +589,7 @@ public function testSchemalessDeleteDocumentsWithQuery(): void
589589 public function testSchemalessOperationsWithCallback (): void
590590 {
591591 /** @var Database $database */
592- $ database = static :: getDatabase ();
592+ $ database = $ this -> getDatabase ();
593593
594594 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
595595 $ this ->expectNotToPerformAssertions ();
@@ -677,7 +677,7 @@ public function testSchemalessOperationsWithCallback(): void
677677 public function testSchemalessIndexCreateListDelete (): void
678678 {
679679 /** @var Database $database */
680- $ database = static :: getDatabase ();
680+ $ database = $ this -> getDatabase ();
681681
682682 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
683683 $ this ->expectNotToPerformAssertions ();
@@ -723,7 +723,7 @@ public function testSchemalessIndexCreateListDelete(): void
723723 public function testSchemalessIndexDuplicatePrevention (): void
724724 {
725725 /** @var Database $database */
726- $ database = static :: getDatabase ();
726+ $ database = $ this -> getDatabase ();
727727
728728 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
729729 $ this ->expectNotToPerformAssertions ();
@@ -754,7 +754,7 @@ public function testSchemalessIndexDuplicatePrevention(): void
754754 public function testSchemalessPermissions (): void
755755 {
756756 /** @var Database $database */
757- $ database = static :: getDatabase ();
757+ $ database = $ this -> getDatabase ();
758758
759759 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
760760 $ this ->expectNotToPerformAssertions ();
@@ -776,18 +776,18 @@ public function testSchemalessPermissions(): void
776776 $ this ->assertFalse ($ doc ->isEmpty ());
777777
778778 // Without roles, cannot read
779- Authorization:: cleanRoles ();
779+ $ database -> getAuthorization ()-> cleanRoles ();
780780 $ empty = $ database ->getDocument ($ col , 'd1 ' );
781781 $ this ->assertTrue ($ empty ->isEmpty ());
782782
783783 // With any role, can read
784- Authorization:: setRole (Role::any ()->toString ());
784+ $ database -> getAuthorization ()-> addRole (Role::any ()->toString ());
785785 $ fetched = $ database ->getDocument ($ col , 'd1 ' );
786786 $ this ->assertEquals ('value ' , $ fetched ->getAttribute ('field ' ));
787787
788788 // Attempt update without update permission
789- Authorization:: cleanRoles ();
790- Authorization:: setRole (Role::any ()->toString ());
789+ $ database -> getAuthorization ()-> cleanRoles ();
790+ $ database -> getAuthorization ()-> addRole (Role::any ()->toString ());
791791 try {
792792 $ database ->updateDocument ($ col , 'd1 ' , new Document (['field ' => 'updated ' ]));
793793 $ this ->fail ('Failed to throw exception ' );
@@ -796,7 +796,7 @@ public function testSchemalessPermissions(): void
796796 }
797797
798798 // Grant update permission and update
799- Authorization:: skip (function () use ($ database , $ col ) {
799+ $ database -> getAuthorization ()-> skip (function () use ($ database , $ col ) {
800800 $ database ->updateDocument ($ col , 'd1 ' , new Document ([
801801 '$permissions ' => [
802802 Permission::read (Role::any ()),
@@ -809,7 +809,7 @@ public function testSchemalessPermissions(): void
809809 $ this ->assertEquals ('updated ' , $ updated ->getAttribute ('field ' ));
810810
811811 // Creating without any roles should fail
812- Authorization:: cleanRoles ();
812+ $ database -> getAuthorization ()-> cleanRoles ();
813813 try {
814814 $ database ->createDocument ($ col , new Document ([
815815 'field ' => 'x '
@@ -820,13 +820,13 @@ public function testSchemalessPermissions(): void
820820 }
821821
822822 $ database ->deleteCollection ($ col );
823- Authorization:: cleanRoles ();
823+ $ database -> getAuthorization ()-> cleanRoles ();
824824 }
825825
826826 public function testSchemalessInternalAttributes (): void
827827 {
828828 /** @var Database $database */
829- $ database = static :: getDatabase ();
829+ $ database = $ this -> getDatabase ();
830830
831831 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
832832 $ this ->expectNotToPerformAssertions ();
@@ -836,7 +836,7 @@ public function testSchemalessInternalAttributes(): void
836836 $ col = uniqid ('sl_internal_full ' );
837837 $ database ->createCollection ($ col );
838838
839- Authorization:: setRole (Role::any ()->toString ());
839+ $ database -> getAuthorization ()-> addRole (Role::any ()->toString ());
840840
841841 $ doc = $ database ->createDocument ($ col , new Document ([
842842 '$id ' => 'i1 ' ,
@@ -930,13 +930,13 @@ public function testSchemalessInternalAttributes(): void
930930 $ database ->setPreserveDates (false );
931931
932932 $ database ->deleteCollection ($ col );
933- Authorization:: cleanRoles ();
933+ $ database -> getAuthorization ()-> cleanRoles ();
934934 }
935935
936936 public function testSchemalessDates (): void
937937 {
938938 /** @var Database $database */
939- $ database = static :: getDatabase ();
939+ $ database = $ this -> getDatabase ();
940940
941941 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
942942 $ this ->expectNotToPerformAssertions ();
0 commit comments