| @@ 102-130 (lines=29) @@ | ||
| 99 | ]); |
|
| 100 | } |
|
| 101 | ||
| 102 | public function testNonNullScalarValidationSuccess() |
|
| 103 | { |
|
| 104 | $res = GraphQL::executeQuery( |
|
| 105 | $this->schema, |
|
| 106 | Utils::nowdoc(' |
|
| 107 | mutation UpdateBook( |
|
| 108 | $bookId:ID! |
|
| 109 | ) { |
|
| 110 | updateBook (bookId: $bookId) { |
|
| 111 | valid |
|
| 112 | suberrors { |
|
| 113 | bookId { |
|
| 114 | code |
|
| 115 | msg |
|
| 116 | } |
|
| 117 | } |
|
| 118 | result { |
|
| 119 | title |
|
| 120 | } |
|
| 121 | } |
|
| 122 | } |
|
| 123 | '), |
|
| 124 | [], |
|
| 125 | null, |
|
| 126 | ['bookId' => 1] |
|
| 127 | ); |
|
| 128 | ||
| 129 | static::assertTrue($res->data['updateBook']['valid']); |
|
| 130 | } |
|
| 131 | ||
| 132 | public function testNonNullScalarValidationFail() |
|
| 133 | { |
|
| @@ 132-161 (lines=30) @@ | ||
| 129 | static::assertTrue($res->data['updateBook']['valid']); |
|
| 130 | } |
|
| 131 | ||
| 132 | public function testNonNullScalarValidationFail() |
|
| 133 | { |
|
| 134 | $res = GraphQL::executeQuery( |
|
| 135 | $this->schema, |
|
| 136 | Utils::nowdoc(' |
|
| 137 | mutation UpdateBook( |
|
| 138 | $bookId:ID! |
|
| 139 | ) { |
|
| 140 | updateBook (bookId: $bookId) { |
|
| 141 | valid |
|
| 142 | suberrors { |
|
| 143 | bookId { |
|
| 144 | code |
|
| 145 | msg |
|
| 146 | } |
|
| 147 | } |
|
| 148 | result { |
|
| 149 | title |
|
| 150 | } |
|
| 151 | } |
|
| 152 | } |
|
| 153 | '), |
|
| 154 | [], |
|
| 155 | null, |
|
| 156 | ['bookId' => 37] |
|
| 157 | ); |
|
| 158 | ||
| 159 | static::assertEmpty($res->errors); |
|
| 160 | static::assertFalse($res->data['updateBook']['valid']); |
|
| 161 | } |
|
| 162 | } |
|
| 163 | ||
| @@ 105-134 (lines=30) @@ | ||
| 102 | ]); |
|
| 103 | } |
|
| 104 | ||
| 105 | public function testNullableScalarValidationOnNullValueSuccess() |
|
| 106 | { |
|
| 107 | $res = GraphQL::executeQuery( |
|
| 108 | $this->schema, |
|
| 109 | Utils::nowdoc(' |
|
| 110 | mutation UpdateBook( |
|
| 111 | $bookId:ID |
|
| 112 | ) { |
|
| 113 | updateBook (bookId: $bookId) { |
|
| 114 | valid |
|
| 115 | suberrors { |
|
| 116 | bookId { |
|
| 117 | code |
|
| 118 | msg |
|
| 119 | } |
|
| 120 | } |
|
| 121 | result { |
|
| 122 | title |
|
| 123 | } |
|
| 124 | } |
|
| 125 | } |
|
| 126 | '), |
|
| 127 | [], |
|
| 128 | null, |
|
| 129 | ['bookId' => null] |
|
| 130 | ); |
|
| 131 | ||
| 132 | static::assertEmpty($res->errors); |
|
| 133 | static::assertTrue($res->data['updateBook']['valid']); |
|
| 134 | } |
|
| 135 | } |
|
| 136 | ||