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 = []) |
||
| 46 | { |
||
| 47 | $this->assertDocumentValidator($this->buildRecursiveQuery($queryDepth), $maxQueryDepth, $expectedErrors); |
||
| 48 | } |
||
| 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 = []) |
||
| 57 | { |
||
| 58 | $this->assertDocumentValidator($this->buildRecursiveUsingFragmentQuery($queryDepth), $maxQueryDepth, $expectedErrors); |
||
| 59 | } |
||
| 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 = []) |
||
| 68 | { |
||
| 69 | $this->assertDocumentValidator($this->buildRecursiveUsingInlineFragmentQuery($queryDepth), $maxQueryDepth, $expectedErrors); |
||
| 70 | } |
||
| 71 | |||
| 72 | public function testComplexityIntrospectionQuery() |
||
| 76 | |||
| 77 | public function testIntrospectionTypeMetaFieldQuery() |
||
| 81 | |||
| 82 | public function testTypeNameMetaFieldQuery() |
||
| 86 | |||
| 87 | public function queryDataProvider() |
||
| 88 | { |
||
| 89 | return [ |
||
| 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 |