|
| 1 | +<?php |
| 2 | +# File generated by "php artisan lighthouse:ide-helper". |
| 3 | +# Do not edit this file directly. |
| 4 | +# This file should be ignored by git as it can be autogenerated. |
| 5 | + |
| 6 | +declare(strict_types=1); |
| 7 | + |
| 8 | +namespace Illuminate\Testing; |
| 9 | + |
| 10 | +use Mockery\MockInterface; |
| 11 | +use Nuwave\Lighthouse\Subscriptions\Contracts\Broadcaster; |
| 12 | +use PHPUnit\Framework\TestCase; |
| 13 | + |
| 14 | +class TestResponse |
| 15 | +{ |
| 16 | + /** |
| 17 | + * Assert the response contains an error with a matching message. |
| 18 | + * |
| 19 | + * @param \Throwable $error the expected error |
| 20 | + * |
| 21 | + * @return $this |
| 22 | + */ |
| 23 | + public function assertGraphQLError(\Throwable $error): self |
| 24 | + { |
| 25 | + return $this; |
| 26 | + } |
| 27 | + |
| 28 | + /** |
| 29 | + * Assert the response contains an error with the given message. |
| 30 | + * |
| 31 | + * @param string $message the expected error message |
| 32 | + * |
| 33 | + * @return $this |
| 34 | + */ |
| 35 | + public function assertGraphQLErrorMessage(string $message): self |
| 36 | + { |
| 37 | + return $this; |
| 38 | + } |
| 39 | + |
| 40 | + /** |
| 41 | + * Assert the response contains an error with the given debug message. |
| 42 | + * |
| 43 | + * Requires the config `lighthouse.debug` to include the option \GraphQL\Error\DebugFlag::INCLUDE_DEBUG_MESSAGE. |
| 44 | + * |
| 45 | + * @param string $message the expected debug message |
| 46 | + * |
| 47 | + * @return $this |
| 48 | + */ |
| 49 | + public function assertGraphQLDebugMessage(string $message): self |
| 50 | + { |
| 51 | + return $this; |
| 52 | + } |
| 53 | + |
| 54 | + /** |
| 55 | + * Assert the response contains no errors. |
| 56 | + * |
| 57 | + * @return $this |
| 58 | + */ |
| 59 | + public function assertGraphQLErrorFree(): self |
| 60 | + { |
| 61 | + return $this; |
| 62 | + } |
| 63 | + |
| 64 | + /** |
| 65 | + * Assert the returned result contains exactly the given validation keys. |
| 66 | + * |
| 67 | + * @param array<string> $keys the validation keys the result should have |
| 68 | + * |
| 69 | + * @return $this |
| 70 | + */ |
| 71 | + public function assertGraphQLValidationKeys(array $keys): self |
| 72 | + { |
| 73 | + return $this; |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * Assert a given validation error is present in the response. |
| 78 | + * |
| 79 | + * @param string $key the validation key that should be present |
| 80 | + * @param string $message the expected validation message |
| 81 | + * |
| 82 | + * @return $this |
| 83 | + */ |
| 84 | + public function assertGraphQLValidationError(string $key, string $message): self |
| 85 | + { |
| 86 | + return $this; |
| 87 | + } |
| 88 | + |
| 89 | + /** |
| 90 | + * Assert no validation errors are present in the response. |
| 91 | + * |
| 92 | + * @return $this |
| 93 | + */ |
| 94 | + public function assertGraphQLValidationPasses(): self |
| 95 | + { |
| 96 | + return $this; |
| 97 | + } |
| 98 | + |
| 99 | + /** |
| 100 | + * Assert current user is authorized to join a subscription. |
| 101 | + * |
| 102 | + * @param \PHPUnit\Framework\TestCase $testClassInstance usually $this when calling this from a test class |
| 103 | + * |
| 104 | + * @return $this |
| 105 | + */ |
| 106 | + public function assertGraphQLSubscriptionAuthorized(TestCase $testClassInstance): self |
| 107 | + { |
| 108 | + return $this; |
| 109 | + } |
| 110 | + |
| 111 | + /** |
| 112 | + * Assert current user is NOT authorized to join a subscription. |
| 113 | + * |
| 114 | + * @param \PHPUnit\Framework\TestCase $testClassInstance usually $this when calling this from a test class |
| 115 | + * |
| 116 | + * @return $this |
| 117 | + */ |
| 118 | + public function assertGraphQLSubscriptionNotAuthorized(TestCase $testClassInstance): self |
| 119 | + { |
| 120 | + return $this; |
| 121 | + } |
| 122 | + |
| 123 | + /** |
| 124 | + * For cases where you need more control over your broadcast assertions. |
| 125 | + * |
| 126 | + * @see \Nuwave\Lighthouse\Testing\TestResponseMixin::assertGraphQLBroadcasted |
| 127 | + * @see \Nuwave\Lighthouse\Testing\TestResponseMixin::assertGraphQLNotBroadcasted |
| 128 | + * |
| 129 | + * @return \Mockery\MockInterface&\Nuwave\Lighthouse\Subscriptions\Contracts\Broadcaster |
| 130 | + */ |
| 131 | + public function graphQLSubscriptionMock() // @phpstan-ignore-line invalid return type? |
| 132 | + { |
| 133 | + $mock = \Mockery::mock(Broadcaster::class); |
| 134 | + assert($mock instanceof Broadcaster && $mock instanceof MockInterface); |
| 135 | + |
| 136 | + return $mock; |
| 137 | + } |
| 138 | + |
| 139 | + /** Get the channel name from a subscription query. */ |
| 140 | + public function graphQLSubscriptionChannelName(): string |
| 141 | + { |
| 142 | + return ''; |
| 143 | + } |
| 144 | + |
| 145 | + /** |
| 146 | + * Assert the subscription received the given broadcasts. |
| 147 | + * |
| 148 | + * @param array<int, array<string, mixed>> $data the broadcast pattern that you are expecting |
| 149 | + * |
| 150 | + * @return $this |
| 151 | + */ |
| 152 | + public function assertGraphQLBroadcasted(array $data): self |
| 153 | + { |
| 154 | + return $this; |
| 155 | + } |
| 156 | + |
| 157 | + /** |
| 158 | + * Assert the subscription received no broadcast. |
| 159 | + * |
| 160 | + * @return $this |
| 161 | + */ |
| 162 | + public function assertGraphQLNotBroadcasted(): self |
| 163 | + { |
| 164 | + return $this; |
| 165 | + } |
| 166 | +} |
0 commit comments