Skip to content

Commit ba2f747

Browse files
author
Luis
committed
Testing: Fix deprecated functions
1 parent 6b038f1 commit ba2f747

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

tests/src/Kernel/Framework/TestFrameworkTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Drupal\Core\Cache\CacheableMetadata;
66
use Drupal\graphql\GraphQL\Cache\CacheableValue;
77
use Drupal\graphql\GraphQL\Execution\ResolveContext;
8-
use Drupal\graphql\Plugin\SchemaBuilder;
98
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;
109
use GraphQL\Type\Definition\ResolveInfo;
1110

@@ -35,7 +34,7 @@ public function testFieldMock() {
3534
]);
3635

3736
$schema = $this->introspect();
38-
$this->assertArraySubset([
37+
$this->assertSame([
3938
'types' => [
4039
'Query' => [
4140
'fields' => [
@@ -232,13 +231,17 @@ public function testUnionMock() {
232231
'name' => 'value',
233232
'type' => 'Int',
234233
'parents' => ['Number'],
235-
], function ($value) { yield $value['value']; });
234+
], function ($value) {
235+
yield $value['value'];
236+
});
236237

237238
$this->mockField('string_value', [
238239
'name' => 'value',
239240
'type' => 'String',
240241
'parents' => ['Word'],
241-
], function ($value) { yield $value['value']; });
242+
], function ($value) {
243+
yield $value['value'];
244+
});
242245

243246
$this->mockField('root', [
244247
'name' => 'root',

tests/src/Traits/GraphQLFileTestTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ trait GraphQLFileTestTrait {
1818
* The path to the collection of test query files.
1919
*/
2020
protected function getQueriesDirectory() {
21-
return drupal_get_path('module', explode('\\', get_class($this))[2]) . '/tests/queries';
21+
return \Drupal::service('extension.list.module')->getPath('module', explode('\\', get_class($this))[2]) . '/tests/queries'
2222
}
2323

2424
/**

tests/src/Unit/StringFormattingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class StringFormattingTest extends UnitTestCase {
1717
* @expectedExceptionMessageRegExp /Failed to create a specification compliant string representation for '.+'\./
1818
*/
1919
public function testFailureOnInvalidInput() {
20-
$this->expectException(InvalidArgumentException::class);
20+
$this->expectException(\InvalidArgumentException::class);
2121
StringHelper::camelCase('^%!@#&');
2222
}
2323

0 commit comments

Comments
 (0)