We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 16 | class QueryDepthTest extends AbstractQuerySecurityTest |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @param $max |
||
| 20 | * @param $count |
||
| 21 | * |
||
| 22 | * @return string |
||
| 23 | */ |
||
| 24 | protected function getErrorMessage($max, $count) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param $maxDepth |
||
| 31 | * |
||
| 32 | * @return QueryDepth |
||
| 33 | */ |
||
| 34 | protected function createRule($maxDepth) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param $queryDepth |
||
| 41 | * @param int $maxQueryDepth |
||
| 42 | * @param array $expectedErrors |
||
| 43 | * @dataProvider queryDataProvider |
||
| 44 | */ |
||
| 45 | public function testSimpleQueries($queryDepth, $maxQueryDepth = 7, $expectedErrors = []) |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @param $queryDepth |
||
| 52 | * @param int $maxQueryDepth |
||
| 53 | * @param array $expectedErrors |
||
| 54 | * @dataProvider queryDataProvider |
||
| 55 | */ |
||
| 56 | public function testFragmentQueries($queryDepth, $maxQueryDepth = 7, $expectedErrors = []) |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @param $queryDepth |
||
| 63 | * @param int $maxQueryDepth |
||
| 64 | * @param array $expectedErrors |
||
| 65 | * @dataProvider queryDataProvider |
||
| 66 | */ |
||
| 67 | public function testInlineFragmentQueries($queryDepth, $maxQueryDepth = 7, $expectedErrors = []) |
||
| 71 | |||
| 72 | public function testComplexityIntrospectionQuery() |
||
| 76 | |||
| 77 | public function testIntrospectionTypeMetaFieldQuery() |
||
| 81 | |||
| 82 | public function testTypeNameMetaFieldQuery() |
||
| 86 | |||
| 87 | public function queryDataProvider() |
||
| 88 | { |
||
| 89 | return [ |
||
| 90 | [1], // Valid because depth under default limit (7) |
||
| 91 | [2], |
||
| 92 | [3], |
||
| 93 | [4], |
||
| 94 | [5], |
||
| 95 | [6], |
||
| 96 | [7], |
||
| 97 | [8, 9], // Valid because depth under new limit (9) |
||
| 98 | [10, 0], // Valid because 0 depth disable limit |
||
| 99 | [ |
||
| 100 | 10, |
||
| 101 | 8, |
||
| 102 | [$this->createFormattedError(8, 10)], |
||
| 103 | ], // failed because depth over limit (8) |
||
| 104 | [ |
||
| 105 | 20, |
||
| 106 | 15, |
||
| 107 | [$this->createFormattedError(15, 20)], |
||
| 108 | ], // failed because depth over limit (15) |
||
| 109 | ]; |
||
| 110 | } |
||
| 111 | |||
| 112 | private function buildRecursiveQuery($depth) |
||
| 118 | |||
| 119 | private function buildRecursiveUsingFragmentQuery($depth) |
||
| 128 | |||
| 129 | private function buildRecursiveUsingInlineFragmentQuery($depth) |
||
| 138 | |||
| 139 | private function buildRecursiveQueryPart($depth) |
||
| 158 | } |
||
| 159 |