-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathsidebar.feature
More file actions
74 lines (65 loc) · 2.13 KB
/
sidebar.feature
File metadata and controls
74 lines (65 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Feature: Manage WordPress sidebars
Background:
Given a WP install
And I try `wp theme delete twentytwelve --force`
And I run `wp theme install twentytwelve --activate`
Scenario: List available sidebars
When I run `wp sidebar list --fields=name,id`
Then STDOUT should be a table containing rows:
| name | id |
| Main Sidebar | sidebar-1 |
| First Front Page Widget Area | sidebar-2 |
| Second Front Page Widget Area | sidebar-3 |
| Inactive Widgets | wp_inactive_widgets |
When I run `wp sidebar list --format=ids`
Then STDOUT should be:
"""
sidebar-1 sidebar-2 sidebar-3 wp_inactive_widgets
"""
When I run `wp sidebar list --format=count`
Then STDOUT should be:
"""
4
"""
Scenario: List inactive sidebars
When I run `wp sidebar list --inactive --format=count`
Then STDOUT should be:
"""
0
"""
Given a sidebar-update.php file:
"""
<?php
update_option( 'sidebars_widgets', array_merge( wp_get_sidebars_widgets(), [ 'orphaned-sidebar-1' => [] ] ) );
"""
When I run `wp eval-file sidebar-update.php`
And I run `wp sidebar list --inactive --fields=id --format=csv`
Then STDOUT should be:
"""
id
orphaned-sidebar-1
"""
When I run `wp sidebar list --fields=id --format=ids`
Then STDOUT should not contain:
"""
orphaned-sidebar-1
"""
Scenario: Get sidebar details
When I run `wp sidebar get sidebar-1`
Then STDOUT should contain:
"""
sidebar-1
"""
Scenario: Sidebar exists command returns success
When I run `wp sidebar exists sidebar-1`
Then the return code should be 0
Scenario: Sidebar exists command returns failure
When I try `wp sidebar exists does-not-exist`
Then the return code should be 1
Scenario: Get non-existing sidebar returns error
When I try `wp sidebar get does-not-exist`
Then STDERR should contain:
"""
does not exist
"""
And the return code should be 1