Skip to content

Commit 477aff4

Browse files
committed
- update test to test example query
1 parent 0ff5b65 commit 477aff4

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/functional/TestCloneWithRepeaterCest.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,44 @@ interfaces {
137137
$I->assertNull( $field['type']['ofType']['name'] );
138138
$I->assertSame( 'PlantsCloneRoots', $field['type']['name'] );
139139

140+
$query = '
141+
query GetPageWithPlants($databaseId: ID!) {
142+
page(id:$databaseId idType:DATABASE_ID) {
143+
id
144+
title
145+
...on WithAcfPlants {
146+
plants {
147+
name
148+
clonedRepeater {
149+
notClonedRepeater {
150+
anotherName
151+
}
152+
}
153+
notClonedRepeater {
154+
anotherName
155+
}
156+
}
157+
}
158+
}
159+
}
160+
';
161+
162+
$I->haveHttpHeader( 'Content-Type', 'application/json' );
163+
$I->sendPost( '/graphql', json_encode([
164+
'query' => $query,
165+
'variables' => [
166+
'databaseId' => 0
167+
]
168+
]));
169+
170+
$I->seeResponseCodeIs( 200 );
171+
$I->seeResponseIsJson();
172+
$response = $I->grabResponse();
173+
$response = json_decode( $response, true );
174+
175+
// Validate that the query above was valid, returned data, and no errors
176+
$I->assertNotEmpty( $response['data'] );
177+
$I->assertArrayNotHasKey( 'errors', $response );
140178
}
141179

142180
public function findField( $name, $fields ) {

0 commit comments

Comments
 (0)