From 966d0f344e94c7c93a2965431cf3ddfaf5502104 Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Tue, 26 Sep 2017 14:53:26 -0700 Subject: [PATCH] Tests for 94d630e --- tests/tests/class-plugin-functions.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/tests/class-plugin-functions.php b/tests/tests/class-plugin-functions.php index 1df43c6..e4cf636 100644 --- a/tests/tests/class-plugin-functions.php +++ b/tests/tests/class-plugin-functions.php @@ -90,4 +90,17 @@ class Plugin_Functions extends WP_UnitTestCase { // Should also fail as a blocked event, though normalization would also block it as a duplicate. $this->assertTrue( is_wp_error( WP_CLI_Cron_Control_Offload\schedule_cli_command( 'cli info' ) ) ); } + + /** + * Test each blocked bash operator + */ + function test_for_invalid_bash_operators() { + $this->assertTrue( is_wp_error( WP_CLI_Cron_Control_Offload\validate_command( 'post list & date' ) ) ); + $this->assertTrue( is_wp_error( WP_CLI_Cron_Control_Offload\validate_command( 'post list | date' ) ) ); + $this->assertTrue( is_wp_error( WP_CLI_Cron_Control_Offload\validate_command( 'post list > /tmp/nope' ) ) ); + $this->assertTrue( is_wp_error( WP_CLI_Cron_Control_Offload\validate_command( 'post list 2> /tmp/nope' ) ) ); + $this->assertTrue( is_wp_error( WP_CLI_Cron_Control_Offload\validate_command( 'post list 1>&2 /tmp/nope' ) ) ); + $this->assertTrue( is_wp_error( WP_CLI_Cron_Control_Offload\validate_command( 'post list 2>&1 /tmp/nope' ) ) ); + $this->assertTrue( is_wp_error( WP_CLI_Cron_Control_Offload\validate_command( 'post list &> /tmp/nope' ) ) ); + } } -- GitLab