Skip to content

Commit ed5813b

Browse files
committed
- re-arrange test. Register the settings page and field group _before_ calling update_field (see: https://www.advancedcustomfields.com/resources/acf-field-functions/)
1 parent 1fac14a commit ed5813b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/wpunit/OptionsPageTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,6 @@ public function testOptionsPageRespectsGraphqlFieldName() {
189189
]
190190
);
191191

192-
$expected_value = 'test value';
193-
194-
// Save a value to the ACF Option Field
195-
// see: https://www.advancedcustomfields.com/resources/update_field/#update-a-value-from-different-objects
196-
update_field( 'text', $expected_value, 'custom-graphql-name' );
197-
$get_field = get_field( 'text', 'custom-graphql-name' );
198-
199-
200192
$this->register_acf_field( [], [
201193
'graphql_field_name' => 'OptionsFields',
202194
'location' => [
@@ -210,6 +202,14 @@ public function testOptionsPageRespectsGraphqlFieldName() {
210202
],
211203
]);
212204

205+
$expected_value = 'test value';
206+
207+
// Save a value to the ACF Option Field
208+
// see: https://www.advancedcustomfields.com/resources/update_field/#update-a-value-from-different-objects
209+
update_field( 'text', $expected_value, 'custom-graphql-name' );
210+
$get_field = get_field( 'text', 'custom-graphql-name' );
211+
212+
213213
$query = '
214214
{
215215
myCustomOptionsName { # this is the name of the options page based on graphql_type_name

0 commit comments

Comments
 (0)