Skip to content

Commit

Permalink
Prevent error when not adding new methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tbradsha committed Nov 12, 2024
1 parent d2a1eec commit 891fe28
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,11 @@ private function create_mock_instance(
);

$builder = $this->getMockBuilder( Jetpack_Geo_Location::class )
->onlyMethods( $existing_methods_to_mock )
->addMethods( $new_methods_to_mock );
->onlyMethods( $existing_methods_to_mock );
// This throws an error if passed an empty array.
if ( ! empty( $new_methods_to_mock ) ) {
$builder->addMethods( $new_methods_to_mock );
}

if ( $disable_constructor ) {
$builder->disableOriginalConstructor();
Expand Down

0 comments on commit 891fe28

Please sign in to comment.