Index: tests/phpunit/tests/rest-api/rest-comments-controller.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- tests/phpunit/tests/rest-api/rest-comments-controller.php	(revision 39367)
+++ tests/phpunit/tests/rest-api/rest-comments-controller.php	(revision )
@@ -1007,6 +1007,30 @@
 		update_option( 'require_name_email', 0 );
 	}

+	/**
+	 * @ticket 38971
+	 */
+	public function test_create_comment_empty_required_author_name_and_email_per_option_value() {
+		add_filter( 'rest_allow_anonymous_comments', '__return_true' );
+		update_option( 'require_name_email', 1 );
+
+		$params = array(
+			'author_name'  => '',
+			'post'    => self::$post_id,
+			'content' => 'Now, I don\'t want you to worry class. These tests will have no affect on your grades. They merely determine your future social status and financial success. If any.',
+		);
+
+		$request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
+		$request->add_header( 'content-type', 'application/json' );
+		$request->set_body( wp_json_encode( $params ) );
+
+		$response = $this->server->dispatch( $request );
+
+		$this->assertErrorResponse( 'rest_comment_author_data_required', $response, 400 );
+
+		update_option( 'require_name_email', 0 );
+	}
+
 	public function test_create_comment_missing_required_author_name_per_option_value() {
 		wp_set_current_user( self::$admin_id );
 		update_option( 'require_name_email', 1 );
@@ -1027,6 +1051,30 @@
 		update_option( 'require_name_email', 0 );
 	}

+	/**
+	 * @ticket 38971
+	 */
+	public function test_create_comment_empty_required_author_name_per_option_value() {
+		add_filter( 'rest_allow_anonymous_comments', '__return_true' );
+		update_option( 'require_name_email', 1 );
+
+		$params = array(
+			'author_name'  => '',
+			'post'         => self::$post_id,
+			'author_email' => 'ekrabappel@springfield-elementary.edu',
+			'content'      => 'Now, I don\'t want you to worry class. These tests will have no affect on your grades. They merely determine your future social status and financial success. If any.',
+		);
+
+		$request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
+		$request->add_header( 'content-type', 'application/json' );
+		$request->set_body( wp_json_encode( $params ) );
+
+		$response = $this->server->dispatch( $request );
+		$this->assertErrorResponse( 'rest_comment_author_required', $response, 400 );
+
+		update_option( 'require_name_email', 0 );
+	}
+
 	public function test_create_comment_missing_required_author_email_per_option_value() {
 		wp_set_current_user( self::$admin_id );
 		update_option( 'require_name_email', 1 );
