Skip to content

Commit 46cdb3d

Browse files
Updated last scenario in sidebar feature file and updated list of format, array condtion in sidebar command file
1 parent 530c09a commit 46cdb3d

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

features/sidebar.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ Feature: Manage WordPress sidebars
4444
"""
4545
does not exist
4646
"""
47+
And the return code should be 1

src/Sidebar_Command.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ public function list_( $args, $assoc_args ) {
102102
* default: table
103103
* options:
104104
* - table
105+
* - csv
105106
* - json
107+
* - ids
108+
* - count
106109
* - yaml
107110
* ---
108111
*
@@ -120,7 +123,7 @@ public function get( $args, $assoc_args ) {
120123

121124
$id = $args[0];
122125

123-
if ( ! isset( $wp_registered_sidebars[ $id ] ) ) {
126+
if ( ! array_key_exists( $id, $wp_registered_sidebars ) ) {
124127
WP_CLI::error( "Sidebar '{$id}' does not exist." );
125128
}
126129

@@ -148,7 +151,7 @@ public function exists( $args ) {
148151

149152
Utils\wp_register_unused_sidebar();
150153

151-
if ( isset( $wp_registered_sidebars[ $args[0] ] ) ) {
154+
if ( array_key_exists( $args[0], $wp_registered_sidebars ) ) {
152155
WP_CLI::halt( 0 );
153156
}
154157

0 commit comments

Comments
 (0)