@@ -76,6 +76,8 @@ public static function products( $args, $assoc_args ) {
7676 public static function orders ( $ args , $ assoc_args ) {
7777 list ( $ amount ) = $ args ;
7878
79+ $ time_start = microtime ( true );
80+
7981 $ amount = (int ) $ amount ;
8082 if ( empty ( $ amount ) ) {
8183 $ amount = 100 ;
@@ -98,7 +100,12 @@ public static function orders( $args, $assoc_args ) {
98100 }
99101 $ progress ->finish ();
100102 }
101- WP_CLI ::success ( $ amount . ' orders generated. ' );
103+
104+ $ time_end = microtime ( true );
105+ $ execution_time = round ( ( $ time_end - $ time_start ), 2 );
106+ $ display_time = $ execution_time < 60 ? $ execution_time . ' seconds ' : human_time_diff ( $ time_start , $ time_end );
107+
108+ WP_CLI ::success ( $ amount . ' orders generated in ' . $ display_time );
102109 }
103110
104111 /**
@@ -121,14 +128,21 @@ public static function orders( $args, $assoc_args ) {
121128 public static function customers ( $ args , $ assoc_args ) {
122129 list ( $ amount ) = $ args ;
123130
131+ $ time_start = microtime ( true );
132+
124133 Generator \Customer::disable_emails ();
125134 $ progress = \WP_CLI \Utils \make_progress_bar ( 'Generating customers ' , $ amount );
126135 for ( $ i = 1 ; $ i <= $ amount ; $ i ++ ) {
127136 Generator \Customer::generate ();
128137 $ progress ->tick ();
129138 }
130139 $ progress ->finish ();
131- WP_CLI ::success ( $ amount . ' customers generated. ' );
140+
141+ $ time_end = microtime ( true );
142+ $ execution_time = round ( ( $ time_end - $ time_start ), 2 );
143+ $ display_time = $ execution_time < 60 ? $ execution_time . ' seconds ' : human_time_diff ( $ time_start , $ time_end );
144+
145+ WP_CLI ::success ( $ amount . ' customers generated in ' . $ display_time );
132146 }
133147
134148 /**
@@ -151,6 +165,8 @@ public static function customers( $args, $assoc_args ) {
151165 public static function coupons ( $ args , $ assoc_args ) {
152166 list ( $ amount ) = $ args ;
153167
168+ $ time_start = microtime ( true );
169+
154170 $ amount = (int ) $ amount ;
155171 if ( empty ( $ amount ) ) {
156172 $ amount = 10 ;
@@ -173,7 +189,12 @@ public static function coupons( $args, $assoc_args ) {
173189 }
174190 $ progress ->finish ();
175191 }
176- WP_CLI ::success ( $ amount . ' coupons generated. ' );
192+
193+ $ time_end = microtime ( true );
194+ $ execution_time = round ( ( $ time_end - $ time_start ), 2 );
195+ $ display_time = $ execution_time < 60 ? $ execution_time . ' seconds ' : human_time_diff ( $ time_start , $ time_end );
196+
197+ WP_CLI ::success ( $ amount . ' coupons generated in ' . $ display_time );
177198 }
178199}
179200
0 commit comments