forked from dcblogdev/laravel-microsoft-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphQueryValidatorTest.php
More file actions
43 lines (39 loc) · 1.24 KB
/
GraphQueryValidatorTest.php
File metadata and controls
43 lines (39 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
use Dcblogdev\MsGraph\Validators\GraphQueryValidator;
test('can validate', function () {
$response = GraphQueryValidator::validate([
'$top' => 10,
'$skip' => 5,
'$filter' => 'name eq \'test\'',
'$orderby' => 'name asc',
'$select' => 'name',
'$expand' => 'children',
'$count' => 'true',
'$search' => 'test',
'$format' => 'pdf',
]);
expect($response)->toEqual([
'$top' => 10,
'$skip' => 5,
'$filter' => 'name eq \'test\'',
'$orderby' => 'name asc',
'$select' => 'name',
'$expand' => 'children',
'$count' => 'true',
'$search' => 'test',
'$format' => 'pdf',
]);
});
test('cannot validate none existing params', function () {
GraphQueryValidator::validate([
'$tops' => 10,
'$skip' => 5,
'$filter' => 'name eq \'test\'',
'$orderby' => 'name asc',
'$select' => 'name',
'$expand' => 'children',
'$count' => 'true',
'$search' => 'test',
'$format' => 'pdf',
]);
})->throws(InvalidArgumentException::class, 'Invalid parameters: $tops. Allowed parameters: $top, $skip, $filter, $orderby, $select, $expand, $count, $search, $format.');