From 797e802e4fb6240eec4b74c42018f9d489a5a358 Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Thu, 28 Sep 2017 19:33:17 -0700
Subject: [PATCH] Review feedback

---
 includes/class-command.php             |  5 -----
 tests/tests/class-plugin-functions.php | 30 +++++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/includes/class-command.php b/includes/class-command.php
index 85b1295..a134e6c 100644
--- a/includes/class-command.php
+++ b/includes/class-command.php
@@ -28,11 +28,6 @@ class Command extends WP_CLI_Command {
 	 */
 	public function create( $args, $assoc_args ) {
 		$command = WP_CLI\Utils\get_flag_value( $assoc_args, 'command', '' );
-		$command = validate_command( $command );
-
-		if ( is_wp_error( $command ) ) {
-			WP_CLI::error( $command->get_error_message() );
-		}
 
 		$timestamp = WP_CLI\Utils\get_flag_value( $assoc_args, 'timestamp', null );
 		if ( is_numeric( $timestamp ) ) {
diff --git a/tests/tests/class-plugin-functions.php b/tests/tests/class-plugin-functions.php
index 506ddc7..2845bbc 100644
--- a/tests/tests/class-plugin-functions.php
+++ b/tests/tests/class-plugin-functions.php
@@ -51,11 +51,18 @@ class Plugin_Functions extends WP_UnitTestCase {
 	 * Test whitelisted command validation
 	 *
 	 * @dataProvider whitelisted_command_provider
+	 *
+	 * @param string $command Command to test.
 	 */
 	function test_whitelist_using_validate_command( $command ) {
 		$this->assertTrue( is_string( WP_CLI_Cron_Control_Offload\validate_command( $command ) ) );
 	}
 
+	/**
+	 * Data provider for command whitelisting
+	 *
+	 * @return array
+	 */
 	function whitelisted_command_provider() {
 		return array(
 			array( 'wp post list' ),
@@ -67,11 +74,18 @@ class Plugin_Functions extends WP_UnitTestCase {
 	 * Test blacklisted command validation
 	 *
 	 * @dataProvider blacklisted_command_provider
+	 *
+	 * @param string $command Command to test.
 	 */
 	function test_blacklist_using_validate_command( $command ) {
 		$this->assertWPError( WP_CLI_Cron_Control_Offload\validate_command( $command ) );
 	}
 
+	/**
+	 * Data provider for command blacklisting
+	 *
+	 * @return array
+	 */
 	function blacklisted_command_provider() {
 		return array(
 			array( 'wp cli info' ),
@@ -97,16 +111,23 @@ class Plugin_Functions extends WP_UnitTestCase {
 	 * Test scheduling several of the same blocked event
 	 *
 	 * @dataProvider blocked_events_provider
+	 *
+	 * @param string $command Command to test.
 	 */
 	function test_blocked_event_scheduling( $command ) {
 		$this->assertWPError( WP_CLI_Cron_Control_Offload\schedule_cli_command( $command ) );
 	}
 
+	/**
+	 * Data provider for blocked-event scheduling
+	 *
+	 * @return array
+	 */
 	function blocked_events_provider() {
 		return array(
 			array( 'wp cli info' ), // Should fail, is a blocked event.
 			array( 'wp cli info' ), // Should fail as a blocked event, would otherwise fail as a duplicate.
-			array( 'cli info'), // Should also fail as a blocked event, though normalization would also block it as a duplicate.
+			array( 'cli info' ), // Should also fail as a blocked event, though normalization would also block it as a duplicate.
 		);
 	}
 
@@ -114,11 +135,18 @@ class Plugin_Functions extends WP_UnitTestCase {
 	 * Test each blocked bash operator
 	 *
 	 * @dataProvider invalid_bash_operators_provider
+	 *
+	 * @param string $command Command to test.
 	 */
 	function test_for_invalid_bash_operators( $command ) {
 		$this->assertWPError( WP_CLI_Cron_Control_Offload\validate_command( $command ) );
 	}
 
+	/**
+	 * Data provider for unsupported bash operators
+	 *
+	 * @return array
+	 */
 	function invalid_bash_operators_provider() {
 		return array(
 			array( 'post list & date' ),
-- 
GitLab