Skip to content

Commit

Permalink
Testing: Fix deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis committed Sep 7, 2023
1 parent 6b038f1 commit ba2f747
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions tests/src/Kernel/Framework/TestFrameworkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\graphql\GraphQL\Cache\CacheableValue;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use Drupal\graphql\Plugin\SchemaBuilder;
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;
use GraphQL\Type\Definition\ResolveInfo;

Expand Down Expand Up @@ -35,7 +34,7 @@ public function testFieldMock() {
]);

$schema = $this->introspect();
$this->assertArraySubset([
$this->assertSame([
'types' => [
'Query' => [
'fields' => [
Expand Down Expand Up @@ -232,13 +231,17 @@ public function testUnionMock() {
'name' => 'value',
'type' => 'Int',
'parents' => ['Number'],
], function ($value) { yield $value['value']; });
], function ($value) {
yield $value['value'];
});

$this->mockField('string_value', [
'name' => 'value',
'type' => 'String',
'parents' => ['Word'],
], function ($value) { yield $value['value']; });
], function ($value) {
yield $value['value'];
});

$this->mockField('root', [
'name' => 'root',
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Traits/GraphQLFileTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait GraphQLFileTestTrait {
* The path to the collection of test query files.
*/
protected function getQueriesDirectory() {
return drupal_get_path('module', explode('\\', get_class($this))[2]) . '/tests/queries';
return \Drupal::service('extension.list.module')->getPath('module', explode('\\', get_class($this))[2]) . '/tests/queries'
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Unit/StringFormattingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class StringFormattingTest extends UnitTestCase {
* @expectedExceptionMessageRegExp /Failed to create a specification compliant string representation for '.+'\./
*/
public function testFailureOnInvalidInput() {
$this->expectException(InvalidArgumentException::class);
$this->expectException(\InvalidArgumentException::class);
StringHelper::camelCase('^%!@#&');
}

Expand Down

0 comments on commit ba2f747

Please sign in to comment.