Sort arrays before comparison in unit test

Without this a test fails in GitHub
("Run unit tests with code coverage" task).
This commit is contained in:
Nestor Soriano 2021-11-23 10:09:30 +01:00
parent b068ade7c6
commit 5253a1adae
No known key found for this signature in database
GPG Key ID: 08110F3518C12CAD
1 changed files with 5 additions and 2 deletions

View File

@ -1356,9 +1356,12 @@ class FiltererTest extends \WC_Unit_Test_Case {
wp_set_object_terms( $product_simple_1->get_id(), $terms, 'product_visibility' );
wp_set_object_terms( $product_variable_1['id'], $terms, 'product_visibility' );
$filtered_product_ids = $this->do_product_request( array() );
$actual_filtered_product_ids = $this->do_product_request( array() );
$expected_filtered_product_ids = array( $product_simple_2->get_id(), $product_variable_2['id'] );
sort( $actual_filtered_product_ids );
sort( $expected_filtered_product_ids );
$this->assertEquals( array( $product_simple_2->get_id(), $product_variable_2['id'] ), $filtered_product_ids );
$this->assertEquals( $expected_filtered_product_ids, $actual_filtered_product_ids );
$this->assert_counters( 'Color', $expected_colors_included_in_counters );
$this->assert_counters( 'Features', array( 'Ironable' ) );