Skip to content

Commit 5a876a4

Browse files
committed
Checking priorities
1 parent 81f17f2 commit 5a876a4

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

tests/Fixtures/Integration/Models/Contact.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use DateTimeInterface;
88
use Psr\Http\Message\UploadedFileInterface;
9+
use TheCodingMachine\GraphQLite\Annotations\Field;
910
use TheCodingMachine\GraphQLite\Annotations\Type;
1011

1112
/**
@@ -33,6 +34,10 @@ class Contact
3334
* @var DateTimeInterface
3435
*/
3536
private $birthDate;
37+
/**
38+
* @var string
39+
*/
40+
private $company;
3641

3742
public function __construct(string $name)
3843
{
@@ -107,4 +112,23 @@ public function setBirthDate(DateTimeInterface $birthDate): void
107112
{
108113
$this->birthDate = $birthDate;
109114
}
115+
116+
/**
117+
* Here, we are testing overriding the field in the extend class.
118+
*
119+
* @Field()
120+
* @return string
121+
*/
122+
public function getCompany(): string
123+
{
124+
return $this->company;
125+
}
126+
127+
/**
128+
* @param string $company
129+
*/
130+
public function setCompany(string $company): void
131+
{
132+
$this->company = $company;
133+
}
110134
}

tests/Fixtures/Integration/Types/ExtendedContactType.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,15 @@ public function uppercaseName(Contact $contact): string
2222
{
2323
return strtoupper($contact->getName());
2424
}
25-
}
25+
26+
/**
27+
* Here, we are testing overriding the field in the extend class.
28+
*
29+
* @Field()
30+
* @return string
31+
*/
32+
public function company(Contact $contact): string
33+
{
34+
return $contact->getName().' Ltd';
35+
}
36+
}

tests/Integration/EndToEndTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ public function testEndToEnd()
195195
query {
196196
contacts {
197197
name
198+
company
198199
uppercaseName
199200
... on User {
200201
email
@@ -212,10 +213,12 @@ public function testEndToEnd()
212213
'contacts' => [
213214
[
214215
'name' => 'Joe',
216+
'company' => 'Joe Ltd',
215217
'uppercaseName' => 'JOE'
216218
],
217219
[
218220
'name' => 'Bill',
221+
'company' => 'Bill Ltd',
219222
'uppercaseName' => 'BILL',
220223
'email' => 'bill@example.com'
221224
]
@@ -233,10 +236,12 @@ public function testEndToEnd()
233236
'contacts' => [
234237
[
235238
'name' => 'Joe',
239+
'company' => 'Joe Ltd',
236240
'uppercaseName' => 'JOE'
237241
],
238242
[
239243
'name' => 'Bill',
244+
'company' => 'Bill Ltd',
240245
'uppercaseName' => 'BILL',
241246
'email' => 'bill@example.com'
242247
]

0 commit comments

Comments
 (0)