@@ -2447,6 +2447,7 @@ public function testPasswordProtectedPost() {
24472447 content
24482448 status
24492449 password
2450+ hasPassword
24502451 }
24512452 }
24522453 ' ;
@@ -2464,6 +2465,7 @@ public function testPasswordProtectedPost() {
24642465 $ this ->assertEquals ( 'publish ' , $ actual ['data ' ]['post ' ]['status ' ], 'Status should be "publish" when unauthenticated ' );
24652466 $ this ->assertNull ( $ actual ['data ' ]['post ' ]['content ' ], 'Content should be null when unauthenticated ' );
24662467 $ this ->assertNull ( $ actual ['data ' ]['post ' ]['password ' ], 'Password should be null when unauthenticated ' );
2468+ $ this ->assertTrue ( $ actual ['data ' ]['post ' ]['hasPassword ' ], 'hasPassword should be true when unauthenticated ' );
24672469
24682470 // Test password protected post as a subscriber.
24692471 wp_set_current_user ( $ subscriber );
@@ -2479,6 +2481,7 @@ public function testPasswordProtectedPost() {
24792481 $ this ->assertEquals ( 'publish ' , $ actual ['data ' ]['post ' ]['status ' ], 'Status should be "publish" when lacking permissions ' );
24802482 $ this ->assertNull ( $ actual ['data ' ]['post ' ]['content ' ], 'Content should be null when lacking permissions ' );
24812483 $ this ->assertNull ( $ actual ['data ' ]['post ' ]['password ' ], 'Password should be null when lacking permissions ' );
2484+ $ this ->assertTrue ( $ actual ['data ' ]['post ' ]['hasPassword ' ], 'hasPassword should be true when lacking permissions ' );
24822485
24832486 // Test password protected post as different author.
24842487 wp_set_current_user ( $ post_author_two );
@@ -2494,6 +2497,7 @@ public function testPasswordProtectedPost() {
24942497 $ this ->assertEquals ( 'publish ' , $ actual ['data ' ]['post ' ]['status ' ], 'Status should be "publish" when lacking permissions ' );
24952498 $ this ->assertNull ( $ actual ['data ' ]['post ' ]['content ' ], 'Content should be null when lacking permissions ' );
24962499 $ this ->assertNull ( $ actual ['data ' ]['post ' ]['password ' ], 'Password should be null when lacking permissions ' );
2500+ $ this ->assertTrue ( $ actual ['data ' ]['post ' ]['hasPassword ' ], 'hasPassword should be true when lacking permissions ' );
24972501
24982502 // Test password protected post as current author.
24992503 wp_set_current_user ( $ post_author_one );
@@ -2510,6 +2514,7 @@ public function testPasswordProtectedPost() {
25102514 $ this ->assertEquals ( 'publish ' , $ actual ['data ' ]['post ' ]['status ' ], 'Status should be "publish" when authenticated ' );
25112515 $ this ->assertNotEmpty ( $ actual ['data ' ]['post ' ]['content ' ], 'Content should be returned when authenticated ' );
25122516 $ this ->assertEquals ( $ post ->post_password , $ actual ['data ' ]['post ' ]['password ' ], 'Password should be returned when authenticated ' );
2517+ $ this ->assertTrue ( $ actual ['data ' ]['post ' ]['hasPassword ' ], 'hasPassword should be true when authenticated ' );
25132518
25142519 // Test password protected post as admin.
25152520 wp_set_current_user ( $ this ->admin );
@@ -2526,6 +2531,7 @@ public function testPasswordProtectedPost() {
25262531 $ this ->assertEquals ( 'publish ' , $ actual ['data ' ]['post ' ]['status ' ], 'Status should be "publish" when authenticated ' );
25272532 $ this ->assertNotEmpty ( $ actual ['data ' ]['post ' ]['content ' ], 'Content should be returned when authenticated ' );
25282533 $ this ->assertEquals ( $ post ->post_password , $ actual ['data ' ]['post ' ]['password ' ], 'Password should be returned when authenticated ' );
2534+ $ this ->assertTrue ( $ actual ['data ' ]['post ' ]['hasPassword ' ], 'hasPassword should be true when authenticated ' );
25292535
25302536 // @todo add case with password supplied once supported.
25312537 // @see https://github.com/wp-graphql/wp-graphql/issues/930
0 commit comments