Skip to content

Commit 35da234

Browse files
committed
- add failing test
1 parent 114a2fe commit 35da234

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/_support/WPUnit/AcfFieldTestCase.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,45 @@ public function testFieldShowsInSchemaIfShowInGraphqlIsNull() {
551551

552552
}
553553

554+
public function testFieldDoesNotShowInSchemaIfShowInGraphqlIsZero() {
555+
556+
$field_key = $this->register_acf_field([
557+
'show_in_graphql' => 0
558+
]);
559+
560+
$query = '
561+
query GetType( $name: String! ) {
562+
__type( name: $name ) {
563+
name
564+
fields {
565+
name
566+
}
567+
}
568+
}
569+
';
570+
571+
$actual = $this->graphql( [
572+
'query' => $query,
573+
'variables' => [
574+
'name' => 'AcfTestGroup',
575+
]
576+
]);
577+
578+
codecept_debug( $actual );
579+
580+
// the query should succeed
581+
self::assertQuerySuccessful( $actual, [
582+
// the instructions should be used for the description
583+
$this->not()->expectedNode( '__type.fields', [
584+
'name' => $this->get_formatted_field_name(),
585+
]),
586+
] );
587+
588+
// remove the local field
589+
acf_remove_local_field( $field_key );
590+
591+
}
592+
554593
public function testFieldDoesNotShowInSchemaIfShowInGraphqlIsFalse() {
555594

556595
$field_key = $this->register_acf_field([

0 commit comments

Comments
 (0)