Scenario: Basic export then import
Given a WP install
-
- When I run `wp post generate --post_type=post --count=3`
- Then STDOUT should not be empty
-
- When I run `wp post generate --post_type=page --count=2`
- Then STDOUT should not be empty
-
+ And I run `wp post generate --post_type=post --count=3`
+ And I run `wp post generate --post_type=page --count=2`
When I run `wp post list --post_type=any --format=count`
Then STDOUT should be:
"""
--- /dev/null
+<?php
+
+namespace WP_CLI;
+
+final class NoOp {
+
+ function __set( $key, $value ) {
+ // do nothing
+ }
+
+ function __call( $method, $args ) {
+ // do nothing
+ }
+}
+
$limit = $count + $total;
- $notify = new \cli\progress\Bar( 'Generating posts', $count );
+ $notify = \WP_CLI\Utils\make_progress_bar( 'Generating posts', $count );
$current_depth = 1;
$current_parent = 0;
$limit = $count + $total;
- $notify = new \cli\progress\Bar( 'Generating users', $count );
+ $notify = \WP_CLI\Utils\make_progress_bar( 'Generating users', $count );
for ( $i = $total; $i < $limit; $i++ ) {
$login = sprintf( 'user_%d_%d', $blog_id, $i );
return $m->render( $template, $data );
}
+function make_progress_bar( $message, $count ) {
+ if ( \cli\Shell::isPiped() )
+ return new \WP_CLI\NoOp;
+
+ return new \cli\progress\Bar( $message, $count );
+}
+