Backwards compatibility in unit test

This commit is contained in:
claudiulodro 2018-10-11 10:01:17 -07:00
parent 06e5fe1fd8
commit 4be0018c09
1 changed files with 3 additions and 2 deletions

View File

@ -121,7 +121,8 @@ class WC_Tests_Attributes_Functions extends WC_Unit_Test_Case {
'is_variation' => 0,
'is_taxonomy' => 1,
);
$this->assertEquals( $expected_local_attribute_data, $product_meta_before_update['Test Local Attribute'] );
$local_before = isset( $product_meta_before_update['Test Local Attribute'] ) ? $product_meta_before_update['Test Local Attribute'] : $product_meta_before_update['test-local-attribute'];
$this->assertEquals( $expected_local_attribute_data, $local_before );
$this->assertEquals( $expected_global_attribute_data, $product_meta_before_update['pa_test'] );
// Update the global attribute.
@ -148,7 +149,7 @@ class WC_Tests_Attributes_Functions extends WC_Unit_Test_Case {
'is_variation' => 0,
'is_taxonomy' => 1,
);
$this->assertEquals( $product_meta_before_update['Test Local Attribute'], $product_meta_after_update['Test Local Attribute'] );
$this->assertEquals( $local_before, isset( $product_meta_after_update['Test Local Attribute'] ) ? $product_meta_after_update['Test Local Attribute'] : $product_meta_after_update['test-local-attribute'] );
$this->assertEquals( $expected_global_attribute_data, $product_meta_after_update['pa_testupdate'] );
$this->assertArrayNotHasKey( 'pa_test', $product_meta_after_update );
}