Passed
Pull Request — master (#1)
by Max
05:13
created

BasicTest::testInferNameNameAlreadyExists()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 20
rs 9.8666
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQL\Tests\Type\ValidatedFieldDefinition;
6
7
use GraphQL\Type\Definition\Type;
8
use PHPUnit\Framework\TestCase;
9
10
final class BasicTest extends TestCase
11
{
12
	public function testInferName()
13
	{
14
		$def = new NamelessDef([
15
			'type' => Type::boolean(),
16
			'args' => [
17
				'bookId' => [
18
					'type' => Type::id(),
19
					'errorCodes' => ['bookNotFound'],
20
					'validate' => function ($bookId) {
0 ignored issues
show
Unused Code introduced by
The parameter $bookId is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

20
					'validate' => function (/** @scrutinizer ignore-unused */ $bookId) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
21
						return 0;
22
					},
23
				],
24
			],
25
			'resolve' => static function ($value, $args) : bool {
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

25
			'resolve' => static function ($value, /** @scrutinizer ignore-unused */ $args) : bool {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $value is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

25
			'resolve' => static function (/** @scrutinizer ignore-unused */ $value, $args) : bool {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
				return true;
27
			},
28
		]);
29
30
		static::assertEquals("namelessDef", $def->name);
31
	}
32
33
	public function testInferNameNameAlreadyExists()
34
	{
35
		$def = new NamelessDef([
36
			'name' => "FooDef",
37
			'type' => Type::boolean(),
38
			'args' => [
39
				'bookId' => [
40
					'type' => Type::id(),
41
					'errorCodes' => ['bookNotFound'],
42
					'validate' => function ($bookId) {
0 ignored issues
show
Unused Code introduced by
The parameter $bookId is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

42
					'validate' => function (/** @scrutinizer ignore-unused */ $bookId) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
43
						return 0;
44
					},
45
				],
46
			],
47
			'resolve' => static function ($value, $args) : bool {
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

47
			'resolve' => static function ($value, /** @scrutinizer ignore-unused */ $args) : bool {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $value is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

47
			'resolve' => static function (/** @scrutinizer ignore-unused */ $value, $args) : bool {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
48
				return true;
49
			},
50
		]);
51
52
		static::assertEquals("FooDef", $def->name);
53
	}
54
}
55