Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
doekenorg committed Apr 11, 2024
1 parent 1f5807d commit 83c2933
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion includes/widgets/search-widget/class-search-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ public function gf_query_filter( &$query, $view, $request ) {
private function is_product_field( array $filter ): bool {
$field = GFAPI::get_field( $filter['form_id'] ?? 0, $filter['key'] ?? 0 );

return \GFCommon::is_product_field( $field->type );
return $field && \GFCommon::is_product_field( $field->type );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@
$is_currency = 'currency' === $field->numberFormat;
}

// Add decimal support for total price.
/**
* Modify the step value for the input fields.
*
* @since $ver$
* @param string $value The step size.
* @param GravityView_View $gravityview_view The view object.
*/
$step = apply_filters(
'gk/gravityview/search/number_range/step',
'quantity' === $gravityview_view->search_field['type'] ? '1' : '0.01',
'quantity' === $gravityview_view->search_field['type'] ? '0' : '0.01',
$gravityview_view
);
?>
Expand Down
6 changes: 6 additions & 0 deletions tests/GV_RESTUnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ function setUp() : void {
if ( version_compare( GFForms::$version, '2.2', '<' ) ) {
@GFForms::setup_database();
}

/**
* Add extra level of output buffering to avoid issues.
* @see \GV\REST\Route::ob_start()
*/
ob_start();
}

/**
Expand Down

0 comments on commit 83c2933

Please sign in to comment.