Fix unit test problems in PHP 7.0.
This includes removing two array_merge and array_merge_eecursive statements in the code hacker, that apparently were working differently in PHP 7.0.
This commit is contained in:
parent
5a11d9e064
commit
bcf24f0f8c
|
@ -130,9 +130,9 @@ final class FunctionsMockerHack extends CodeHack {
|
|||
if ( ! is_callable( $mock ) ) {
|
||||
throw new \Exception( "FunctionsMockerHack::add_function_mocks: The mock supplied for '$function_name' isn't callable." );
|
||||
}
|
||||
}
|
||||
|
||||
$this->function_mocks = array_merge( $this->function_mocks, $mocks );
|
||||
$this->function_mocks[ $function_name ] = $mock;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -132,10 +132,10 @@ final class StaticMockerHack extends CodeHack {
|
|||
if ( ! in_array( $class_name, $this->mockable_classes, true ) ) {
|
||||
throw new \Exception( "FunctionsMockerHack::add_function_mocks: Can't mock methods of the '$class_name' class since it isn't in the list of mockable classes supplied to 'initialize'." );
|
||||
}
|
||||
|
||||
$this->method_mocks[ $class_name ][ $method_name ] = $method_mock;
|
||||
}
|
||||
}
|
||||
|
||||
$this->method_mocks = array_merge_recursive( $this->method_mocks, $mocks );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,7 +69,7 @@ class WC_Settings_Accounts_Test extends WC_Settings_Unit_Test_Case {
|
|||
'woocommerce_anonymize_completed_orders' => 'relative_date_selector',
|
||||
);
|
||||
|
||||
$this->assertEqualsCanonicalizing( $expected, $settings_ids_and_types );
|
||||
$this->assertEquals( $expected, $settings_ids_and_types );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,13 +81,7 @@ class WC_Settings_Advanced_Test extends WC_Settings_Unit_Test_Case {
|
|||
$settings = $sut->get_settings( '' );
|
||||
$settings_ids_and_types = $this->get_ids_and_types( $settings );
|
||||
|
||||
FunctionsMockerHack::add_function_mocks(
|
||||
array(
|
||||
'wc_site_is_https' => function() use ( $site_is_https ) {
|
||||
return $site_is_https;
|
||||
},
|
||||
)
|
||||
);
|
||||
update_option( 'home', $site_is_https ? 'https://foo.bar' : 'http://foo.bar' );
|
||||
|
||||
$expected = array(
|
||||
'advanced_page_options' => array( 'title', 'sectionend' ),
|
||||
|
@ -115,9 +109,8 @@ class WC_Settings_Advanced_Test extends WC_Settings_Unit_Test_Case {
|
|||
'woocommerce_logout_endpoint' => 'text',
|
||||
);
|
||||
|
||||
if ( ! $site_is_https ) {
|
||||
$expected['woocommerce_force_ssl_checkout'] = 'checkbox';
|
||||
$expected['woocommerce_unforce_ssl_checkout'] = 'checkbox';
|
||||
if ( $site_is_https ) {
|
||||
unset( $expected['unforce_ssl_checkout'], $expected['force_ssl_checkout'] );
|
||||
}
|
||||
|
||||
$this->assertEquals( $expected, $settings_ids_and_types );
|
||||
|
|
|
@ -44,7 +44,7 @@ class WC_Settings_Page_Test extends WC_Unit_Test_Case {
|
|||
'foo' => 'bar',
|
||||
'example' => 'Example',
|
||||
);
|
||||
$this->assertEqualsCanonicalizing( $expected, $actual );
|
||||
$this->assertEquals( $expected, $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,7 +56,7 @@ class WC_Settings_Page_Test extends WC_Unit_Test_Case {
|
|||
$actual = $sut->get_settings( '' );
|
||||
|
||||
$expected = array( 'key' => 'value' );
|
||||
$this->assertEqualsCanonicalizing( $expected, $actual );
|
||||
$this->assertEquals( $expected, $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +68,7 @@ class WC_Settings_Page_Test extends WC_Unit_Test_Case {
|
|||
$actual = $sut->get_settings( 'foobar' );
|
||||
|
||||
$expected = array( 'foo' => 'bar' );
|
||||
$this->assertEqualsCanonicalizing( $expected, $actual );
|
||||
$this->assertEquals( $expected, $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,7 +80,7 @@ class WC_Settings_Page_Test extends WC_Unit_Test_Case {
|
|||
$actual = $sut->get_settings( 'fizzbuzz' );
|
||||
|
||||
$expected = array( 'fizzbuzz_key' => 'fizzbuzz_value' );
|
||||
$this->assertEqualsCanonicalizing( $expected, $actual );
|
||||
$this->assertEquals( $expected, $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -107,7 +107,7 @@ class WC_Settings_Page_Test extends WC_Unit_Test_Case {
|
|||
$expected_section = 'foobar';
|
||||
$expected_settings = array( 'foo' => 'bar' );
|
||||
$this->assertEquals( $expected_section, $actual_section );
|
||||
$this->assertEqualsCanonicalizing( $expected_settings, $actual_settings );
|
||||
$this->assertEquals( $expected_settings, $actual_settings );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,7 +148,7 @@ class WC_Settings_Page_Test extends WC_Unit_Test_Case {
|
|||
'' => 'General',
|
||||
'new_section' => 'New Section',
|
||||
);
|
||||
$this->assertEqualsCanonicalizing( $expected_sections, $actual_sections );
|
||||
$this->assertEquals( $expected_sections, $actual_sections );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue