-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblock-pattern.feature
More file actions
98 lines (77 loc) · 2.46 KB
/
block-pattern.feature
File metadata and controls
98 lines (77 loc) · 2.46 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Feature: Block pattern commands
@require-wp-5.5
Scenario: List registered block patterns
Given a WP install
When I run `wp block pattern list --format=count`
Then STDOUT should be a number
When I run `wp block pattern list --format=json`
Then STDOUT should not be empty
When I run `wp block pattern list --format=ids`
Then STDOUT should not be empty
@require-wp-5.5
Scenario: Filter patterns by category
Given a WP install
# List all patterns in a category
When I run `wp block pattern list --category=text --format=count`
Then STDOUT should be a number
@require-wp-5.5
Scenario: Search patterns by title
Given a WP install
# Search patterns - this tests the --search functionality
When I run `wp block pattern list --search=header --format=count`
Then STDOUT should be a number
@require-wp-5.5
Scenario: Get a block pattern
Given a WP install
# Get the first pattern name
When I run `wp block pattern list --field=name`
Then STDOUT should not be empty
And save STDOUT '%s' as {PATTERN_NAME}
# Get the pattern details
When I run `wp block pattern get {PATTERN_NAME} --format=json`
Then STDOUT should be JSON containing:
"""
{"name":"{PATTERN_NAME}"}
"""
# Get a specific field
When I run `wp block pattern get {PATTERN_NAME} --field=name`
Then STDOUT should be:
"""
{PATTERN_NAME}
"""
@require-wp-5.5
Scenario: Get a non-existent pattern
Given a WP install
When I try `wp block pattern get nonexistent/pattern`
Then STDERR should contain:
"""
not registered
"""
And the return code should be 1
@require-wp-5.5
Scenario: Search patterns with no matches returns empty
Given a WP install
When I run `wp block pattern list --search=xyznonexistent123 --format=count`
Then STDOUT should be:
"""
0
"""
@require-wp-5.5
Scenario: Get pattern content field
Given a WP install
When I run `wp block pattern list --field=name`
Then STDOUT should not be empty
And save STDOUT '%s' as {PATTERN_NAME}
When I run `wp block pattern get {PATTERN_NAME} --field=content`
Then STDOUT should contain:
"""
<!-- wp:
"""
@require-wp-5.5
Scenario: Filter by non-existent category returns empty
Given a WP install
When I run `wp block pattern list --category=nonexistent --format=count`
Then STDOUT should be:
"""
0
"""