Add test for customer booking sessions to retrieve single-product final pricing with context
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -76,6 +76,37 @@ it('returns final department pricing without requiring list_products permission'
|
||||
expect($response->body)->not->toContain('department_access_' . (int)$department['id']);
|
||||
});
|
||||
|
||||
it('lets customer booking sessions read own single-product final pricing with customer context', function (): void {
|
||||
api_test_covers('GET /products', 'customer-booking');
|
||||
|
||||
$department = api_fixtures()->createDepartment(['name' => 'Single Customer Product Pricing Department']);
|
||||
$product = api_fixtures()->createProduct([
|
||||
'name' => 'Single Customer Priced Product',
|
||||
'price' => 0,
|
||||
'display_in_booking_form' => 0,
|
||||
]);
|
||||
products_api_department_price((int)$department['id'], (int)$product['id'], 175);
|
||||
$session = api_fixtures()->createUserSession(['user']);
|
||||
|
||||
$response = api_client()->get(
|
||||
'/products?final_price=true&id=' . (int)$product['id']
|
||||
. '&department_id=' . (int)$department['id']
|
||||
. '&customer_id=' . (int)$session['user']['customer_number'],
|
||||
$session['headers']
|
||||
);
|
||||
|
||||
$response
|
||||
->assertStatus(200)
|
||||
->assertEnvelope()
|
||||
->assertSuccess();
|
||||
|
||||
expect($response->data())
|
||||
->toBeArray()
|
||||
->toHaveKey('id', (int)$product['id'])
|
||||
->toHaveKey('price', 175);
|
||||
expect($response->body)->not->toContain('department_access_' . (int)$department['id']);
|
||||
});
|
||||
|
||||
it('lets customer booking sessions list public products with final department pricing', function (): void {
|
||||
api_test_covers('GET /products', 'customer-booking');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user