File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,7 +96,13 @@ class QueriesTest extends TestCase
9696
9797 public function setUp (): void
9898 {
99- $ this ->queryValidator = new QueryValidator ($ this ->collection ['attributes ' ]);
99+ // Query validator expects Document[]
100+ $ attributes = []; /** @var Document[] $attributes */
101+ foreach ($ this ->collection ['attributes ' ] as $ attribute ) {
102+ $ attributes [] = new Document ($ attribute );
103+ }
104+
105+ $ this ->queryValidator = new QueryValidator ($ attributes );
100106
101107 $ query1 = Query::parse ('title.notEqual("Iron Man", "Ant Man") ' );
102108 $ query2 = Query::parse ('description.equal("Best movie ever") ' );
Original file line number Diff line number Diff line change 55use Utopia \Database \Validator \QueryValidator ;
66use PHPUnit \Framework \TestCase ;
77use Utopia \Database \Database ;
8+ use Utopia \Database \Document ;
89use Utopia \Database \Query ;
910
1011class QueryValidatorTest extends TestCase
1112{
1213 /**
13- * @var array
14+ * @var Document[]
1415 */
15- protected $ schema = [
16+ protected $ schema ;
17+
18+ /**
19+ * @var array
20+ */
21+ protected $ attributes = [
1622 [
1723 '$id ' => 'title ' ,
1824 'key ' => 'title ' ,
@@ -77,6 +83,10 @@ class QueryValidatorTest extends TestCase
7783
7884 public function setUp (): void
7985 {
86+ // Query validator expects Document[]
87+ foreach ($ this ->attributes as $ attribute ) {
88+ $ this ->schema [] = new Document ($ attribute );
89+ }
8090 }
8191
8292 public function tearDown (): void
You can’t perform that action at this time.
0 commit comments