@@ -23,10 +23,7 @@ Feature: Manage WordPress post blocks
2323 And save STDOUT as {POST_ID}
2424
2525 When I try `wp post has-blocks {POST_ID}`
26- Then STDERR should contain:
27- """
28- Error: Post {POST_ID} does not have blocks.
29- """
26+ Then STDERR should be empty
3027 And the return code should be 1
3128
3229 @require-wp-5.0
@@ -42,17 +39,8 @@ Feature: Manage WordPress post blocks
4239 """
4340 And the return code should be 0
4441
45- @require-wp-5.0
46- Scenario : Check if a post does not contain a specific block type
47- When I run `wp post create --post_title='Block post' --post_content='<!-- wp:paragraph --><p>Hello World</p><!-- /wp:paragraph -->' --porcelain`
48- Then STDOUT should be a number
49- And save STDOUT as {POST_ID}
50-
5142 When I try `wp post has-block {POST_ID} core/image`
52- Then STDERR should contain:
53- """
54- Error: Post {POST_ID} does not contain the block 'core/image'.
55- """
43+ Then STDERR should be empty
5644 And the return code should be 1
5745
5846 @require-wp-5.0
@@ -62,18 +50,21 @@ Feature: Manage WordPress post blocks
6250 And save STDOUT as {POST_ID}
6351
6452 When I run `wp post parse-blocks {POST_ID}`
65- Then STDOUT should be valid JSON
66- And STDOUT should contain:
53+ Then STDOUT should be JSON containing:
6754 """
68- "blockName": "core/paragraph"
55+ [
56+ {
57+ "blockName": "core/paragraph",
58+ "attrs": [],
59+ "innerBlocks": [],
60+ "innerHTML": "<p>Hello World</p>",
61+ "innerContent": [
62+ "<p>Hello World</p>"
63+ ]
64+ }
65+ ]
6966 """
7067
71- @require-wp-5.0
72- Scenario : Parse blocks and output as YAML
73- When I run `wp post create --post_title='Block post' --post_content='<!-- wp:paragraph --><p>Hello World</p><!-- /wp:paragraph -->' --porcelain`
74- Then STDOUT should be a number
75- And save STDOUT as {POST_ID}
76-
7768 When I run `wp post parse-blocks {POST_ID} --format=yaml`
7869 Then STDOUT should contain:
7970 """
@@ -105,11 +96,11 @@ Feature: Manage WordPress post blocks
10596 When I run `wp post get {POST_ID} --field=block_version`
10697 Then STDOUT should match /^\d+$/
10798
108- @require- wp-4.9
99+ @less-than- wp-5.0
109100 Scenario : Post block commands require WordPress 5.0+
110101 When I try `wp post has-blocks 1`
111102 Then STDERR should contain:
112103 """
113- Error: This command requires WordPress 5.0 or greater.
104+ Error: Requires WordPress 5.0 or greater.
114105 """
115106 And the return code should be 1
0 commit comments