1 | <?php |
||
2 | |||
3 | namespace DNADesign\Elemental\Tests\GraphQL; |
||
4 | |||
5 | use DNADesign\Elemental\GraphQL\SortBlockMutationCreator; |
||
6 | use DNADesign\Elemental\Tests\Src\TestElement; |
||
7 | use GraphQL\Type\Definition\ResolveInfo; |
||
0 ignored issues
–
show
|
|||
8 | use SilverStripe\Dev\SapphireTest; |
||
9 | use SilverStripe\Security\Security; |
||
10 | |||
11 | class SortBlockMutationCreatorTest extends SapphireTest |
||
12 | { |
||
13 | protected static $fixture_file = 'SortBlockMutationCreatorTest.yml'; |
||
14 | |||
15 | protected static $extra_dataobjects = [ |
||
16 | TestElement::class, |
||
17 | ]; |
||
18 | |||
19 | /** |
||
20 | * Reorders blocks by compounding each result into the next test (rather than isolated sorting tests) |
||
21 | */ |
||
22 | public function testSortBlock() |
||
23 | { |
||
24 | $this->runMutation(1, 3); |
||
25 | $this->assertIdsInOrder([2, 3, 1, 4]); |
||
26 | |||
27 | $this->runMutation(4, 2); |
||
28 | $this->assertIdsInOrder([2, 4, 3, 1]); |
||
29 | |||
30 | $this->runMutation(1, 0); |
||
31 | $this->assertIdsInOrder([1, 2, 4, 3]); |
||
32 | |||
33 | $this->runMutation(3, 2); |
||
34 | $this->assertIdsInOrder([1, 2, 3, 4]); |
||
35 | } |
||
36 | |||
37 | protected function assertIdsInOrder($ids) |
||
38 | { |
||
39 | $actualIDs = TestElement::get()->sort('Sort')->map()->keys(); |
||
40 | |||
41 | $this->assertSame($ids, $actualIDs); |
||
42 | } |
||
43 | |||
44 | protected function runMutation($id, $afterBlockId) |
||
45 | { |
||
46 | $member = Security::getCurrentUser(); |
||
47 | |||
48 | $mutation = new SortBlockMutationCreator(); |
||
49 | $context = ['currentUser' => $member]; |
||
50 | $resolveInfo = new ResolveInfo([]); |
||
51 | |||
52 | $mutation->resolve(null, [ |
||
53 | 'ID' => $id, |
||
54 | 'AfterBlockID' => $afterBlockId, |
||
55 | ], $context, $resolveInfo); |
||
56 | } |
||
57 | } |
||
58 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths