|
3 | 3 | namespace Drupal\Tests\graphql\Kernel;
|
4 | 4 |
|
5 | 5 | use Drupal\graphql\GraphQL\ResolverRegistry;
|
6 |
| -use Drupal\graphql\Plugin\GraphQL\SchemaExtension\SdlSchemaExtensionPluginBase; |
| 6 | +use Drupal\graphql\Plugin\SchemaExtensionPluginInterface; |
7 | 7 | use Drupal\graphql\Plugin\SchemaExtensionPluginManager;
|
8 | 8 | use Drupal\Tests\graphql\Kernel\Schema\AlterableComposableTestSchema;
|
9 | 9 |
|
@@ -148,17 +148,17 @@ protected function mockSchema($id, $schema, array $extensions = []): void {
|
148 | 148 | ->getMock();
|
149 | 149 |
|
150 | 150 | // Adds extra extension in order to test alter extension data event.
|
151 |
| - $extensions['graphql_alterable_schema_test'] = $this->getMockBuilder(SdlSchemaExtensionPluginBase::class) |
152 |
| - ->disableOriginalConstructor() |
153 |
| - ->onlyMethods(['getBaseDefinition', 'getExtensionDefinition']) |
154 |
| - ->getMockForAbstractClass(); |
| 151 | + $extensions['graphql_alterable_schema_test'] = $this->getMockBuilder(SchemaExtensionPluginInterface::class) |
| 152 | + ->getMock(); |
155 | 153 |
|
156 | 154 | $extensions['graphql_alterable_schema_test']->expects(static::any())
|
157 | 155 | ->method('getBaseDefinition')
|
158 | 156 | ->willReturn('');
|
159 | 157 |
|
160 | 158 | // Different extension definition for different tests.
|
161 |
| - switch ($this->getName()) { |
| 159 | + // PHPUnit compatibility: remove once support for Drupal 10.2 is dropped. |
| 160 | + $methodName = method_exists($this, 'name') ? 'name' : 'getName'; |
| 161 | + switch ($this->$methodName()) { |
162 | 162 | case 'testEmptySchemaExtensionAlteredQueryResultPropertyAdded':
|
163 | 163 | $extensionDefinition = '';
|
164 | 164 | break;
|
@@ -193,7 +193,7 @@ protected function mockSchema($id, $schema, array $extensions = []): void {
|
193 | 193 | $this->container->get('event_dispatcher'),
|
194 | 194 | ])
|
195 | 195 | ->onlyMethods(['getSchemaDefinition', 'getResolverRegistry'])
|
196 |
| - ->getMockForAbstractClass(); |
| 196 | + ->getMock(); |
197 | 197 |
|
198 | 198 | $this->schema->expects(static::any())
|
199 | 199 | ->method('getSchemaDefinition')
|
|
0 commit comments