Fix API suite regressions

This commit is contained in:
Jeppe B
2026-07-08 12:54:26 +02:00
parent 31887fa8c9
commit e14cddc1fb
4 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -330,7 +330,7 @@ class productsRoute
} }
); );
} }
if ($restrictCustomerBookingProducts) { if ($restrictCustomerBookingProducts && !$productId) {
$products = $this->filterProductsVisibleOnBookingForm($products); $products = $this->filterProductsVisibleOnBookingForm($products);
} }
// Return all products, with the department pricing and customer discounts applied // Return all products, with the department pricing and customer discounts applied
@@ -39,9 +39,7 @@ function order_booking_create_department(string $name): array
function order_booking_create_department_price(int $departmentId, int $productId, int $price): void function order_booking_create_department_price(int $departmentId, int $productId, int $price): void
{ {
global $db; $statement = api_test_runtime()->db()->prepare(
$statement = $db->prepare(
'INSERT INTO `product_department_prices` (`department_id`, `product_id`, `price`) 'INSERT INTO `product_department_prices` (`department_id`, `product_id`, `price`)
VALUES (?, ?, ?) VALUES (?, ?, ?)
ON DUPLICATE KEY UPDATE `price` = VALUES(`price`)' ON DUPLICATE KEY UPDATE `price` = VALUES(`price`)'
@@ -425,10 +425,12 @@ it('edits and deletes only matching customer vehicles through the user-scoped su
], $session['headers']); ], $session['headers']);
$deleted = api_client()->delete( $deleted = api_client()->delete(
'/superuser/users/' . $targetUser['id'] . '/vehicles?id=' . $deletableVehicle['id'], '/superuser/users/' . $targetUser['id'] . '/vehicles?id=' . $deletableVehicle['id'],
null,
$session['headers'] $session['headers']
); );
$foreignDelete = api_client()->delete( $foreignDelete = api_client()->delete(
'/superuser/users/' . $targetUser['id'] . '/vehicles?id=' . $otherVehicle['id'], '/superuser/users/' . $targetUser['id'] . '/vehicles?id=' . $otherVehicle['id'],
null,
$session['headers'] $session['headers']
); );
@@ -48,6 +48,11 @@ final class ApiResponse
return $this; return $this;
} }
public function assertError(): self
{
return $this->assertSuccess(false);
}
public function assertMessage(string $expectedMessage): self public function assertMessage(string $expectedMessage): self
{ {
$this->assertEnvelope(); $this->assertEnvelope();