Skip to content

Commit 72877c5

Browse files
authored
Merge pull request #87 from wp-cli/fix/64-category-filter
Adapt tests
2 parents 264c6db + 2dd10ce commit 72877c5

1 file changed

Lines changed: 32 additions & 23 deletions

File tree

features/export.feature

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -275,38 +275,43 @@ Feature: Export content.
275275

276276
Scenario: Export posts from a given category
277277
Given a WP install
278-
279-
When I run `wp plugin install wordpress-importer --activate`
280-
Then STDERR should not contain:
281-
"""
282-
Warning:
283-
"""
278+
And I run `wp site empty --yes`
279+
And I run `wp plugin install wordpress-importer --activate`
284280

285281
When I run `wp term create category Apple --porcelain`
286282
Then STDOUT should be a number
287-
And save STDOUT as {TERM_ID}
283+
And save STDOUT as {APPLE_TERM_ID}
288284

289-
When I run `wp site empty --yes`
290-
And I run `wp post generate --post_type=post --count=10`
291-
And I run `wp post list --post_type=post --format=count`
292-
Then STDOUT should be:
293-
"""
294-
10
295-
"""
285+
When I run `wp term create category Pear --porcelain`
286+
Then STDOUT should be a number
287+
And save STDOUT as {PEAR_TERM_ID}
296288

297-
When I run `for id in $(wp post list --posts_per_page=5 --ids); do wp post term add $id category Apple; done`
298-
And I run `wp post list --post_type=post --cat={TERM_ID} --format=count`
299-
Then STDOUT should be:
300-
"""
301-
5
302-
"""
289+
When I run `wp post create --post_type=post --post_title='Apple Post' --post_category={APPLE_TERM_ID} --porcelain`
290+
Then STDOUT should be a number
291+
And save STDOUT as {APPLE_POST_ID}
292+
293+
When I run `wp post create --post_type=post --post_title='Pear Post' --post_category={PEAR_TERM_ID} --porcelain`
294+
Then STDOUT should be a number
295+
And save STDOUT as {PEAR_POST_ID}
303296

304297
When I run `wp export --post_type=post --category=apple`
305298
And save STDOUT 'Writing to file %s' as {EXPORT_FILE}
306299
Then the {EXPORT_FILE} file should contain:
307300
"""
308301
<category domain="category" nicename="apple"><![CDATA[Apple]]></category>
309302
"""
303+
And the {EXPORT_FILE} file should contain:
304+
"""
305+
<![CDATA[Apple Post]]>
306+
"""
307+
And the {EXPORT_FILE} file should not contain:
308+
"""
309+
<category domain="category" nicename="pear"><![CDATA[Pear]]></category>
310+
"""
311+
And the {EXPORT_FILE} file should not contain:
312+
"""
313+
<![CDATA[Pear Post]]>
314+
"""
310315

311316
When I run `wp site empty --yes`
312317
Then STDOUT should not be empty
@@ -320,10 +325,14 @@ Feature: Export content.
320325
When I run `wp import {EXPORT_FILE} --authors=skip`
321326
Then STDOUT should not be empty
322327

323-
When I run `wp post list --post_type=post --format=count`
324-
Then STDOUT should be:
328+
When I run `wp post list --post_type=post`
329+
Then STDOUT should contain:
325330
"""
326-
5
331+
Apple Post
332+
"""
333+
And STDOUT should not contain:
334+
"""
335+
Pear Post
327336
"""
328337

329338
Scenario: Export posts should include user information

0 commit comments

Comments
 (0)