| Total Complexity | 6 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class InputTypeUtilsTest extends AbstractQueryProviderTest |
||
| 9 | { |
||
| 10 | |||
| 11 | public function testNoReturnType() |
||
| 12 | { |
||
| 13 | $inputTypeGenerator = $this->getInputTypeUtils(); |
||
| 14 | |||
| 15 | $this->expectException(MissingTypeHintException::class); |
||
| 16 | $this->expectExceptionMessage('Factory "TheCodingMachine\\GraphQL\\Controllers\\InputTypeUtilsTest::factoryNoReturnType" must have a return type.'); |
||
| 17 | $inputTypeGenerator->getInputTypeNameAndClassName(new ReflectionMethod($this, 'factoryNoReturnType')); |
||
| 18 | } |
||
| 19 | |||
| 20 | public function testInvalidReturnType() |
||
| 21 | { |
||
| 22 | $inputTypeGenerator = $this->getInputTypeUtils(); |
||
| 23 | |||
| 24 | $this->expectException(MissingTypeHintException::class); |
||
| 25 | $this->expectExceptionMessage('The return type of factory "TheCodingMachine\\GraphQL\\Controllers\\InputTypeUtilsTest::factoryStringReturnType" must be an object, "string" passed instead.'); |
||
| 26 | $inputTypeGenerator->getInputTypeNameAndClassName(new ReflectionMethod($this, 'factoryStringReturnType')); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function testNullableReturnType() |
||
| 30 | { |
||
| 31 | $inputTypeGenerator = $this->getInputTypeUtils(); |
||
| 32 | |||
| 33 | $this->expectException(MissingTypeHintException::class); |
||
| 34 | $this->expectExceptionMessage('Factory "TheCodingMachine\\GraphQL\\Controllers\\InputTypeUtilsTest::factoryNullableReturnType" must have a non nullable return type.'); |
||
| 35 | $inputTypeGenerator->getInputTypeNameAndClassName(new ReflectionMethod($this, 'factoryNullableReturnType')); |
||
| 36 | } |
||
| 37 | |||
| 38 | public function factoryNoReturnType() |
||
| 39 | { |
||
| 40 | |||
| 41 | } |
||
| 42 | |||
| 43 | public function factoryStringReturnType(): string |
||
| 44 | { |
||
| 45 | return ''; |
||
| 46 | } |
||
| 47 | |||
| 48 | public function factoryNullableReturnType(): ?TestObject |
||
| 51 | } |
||
| 52 | |||
| 53 | } |
||
| 54 |