File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -149,9 +149,10 @@ protected static function create_global_attribute( $raw_name ) {
149149 * Generate attributes for a product.
150150 *
151151 * @param integer $qty Number of attributes to generate.
152+ * @param integer $maximum_terms Maximum number of terms per attribute to generate.
152153 * @return array Array of attributes.
153154 */
154- protected static function generate_attributes ( $ qty = 1 ) {
155+ protected static function generate_attributes ( $ qty = 1 , $ maximum_terms = 10 ) {
155156 $ used_names = array ();
156157 $ attributes = array ();
157158
@@ -190,7 +191,7 @@ protected static function generate_attributes( $qty = 1 ) {
190191
191192 $ used_names [] = $ raw_name ;
192193
193- $ num_values = self ::$ faker ->numberBetween ( 1 , 10 );
194+ $ num_values = self ::$ faker ->numberBetween ( 1 , $ maximum_terms );
194195 $ values = array ();
195196 $ existing_values = self ::$ global_attributes [ $ raw_name ];
196197
@@ -232,7 +233,7 @@ protected static function generate_variable_product() {
232233 $ product = new \WC_Product_Variable ();
233234
234235 $ gallery = self ::maybe_get_gallery_image_ids ();
235- $ attributes = self ::generate_attributes ( self ::$ faker ->numberBetween ( 1 , 3 ) );
236+ $ attributes = self ::generate_attributes ( self ::$ faker ->numberBetween ( 1 , 3 ), 5 );
236237
237238 $ product ->set_props ( array (
238239 'name ' => $ name ,
You can’t perform that action at this time.
0 commit comments