41 lines
1.6 KiB
PHP
41 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use classes\customer_order_product_policy;
|
|
|
|
it('recognizes tankcleaning products by category and legacy names', function (): void {
|
|
expect(customer_order_product_policy::isTankCleaningProductRow([
|
|
'product_category' => 5,
|
|
'product_name' => 'Saebe/kemi, 1-4 spulehoveder',
|
|
'category_name' => 'Other',
|
|
]))->toBeTrue()
|
|
->and(customer_order_product_policy::isTankCleaningProductRow([
|
|
'product_category' => 3,
|
|
'product_name' => 'Tank cleaning 4 spulehoveder',
|
|
'category_name' => 'Other',
|
|
]))->toBeTrue()
|
|
->and(customer_order_product_policy::isTankCleaningProductRow([
|
|
'product_category' => 3,
|
|
'product_name' => 'Saebe/kemi, 1-4 spulehoveder',
|
|
'category_name' => 'Tankrens',
|
|
]))->toBeTrue();
|
|
});
|
|
|
|
it('detects only tankcleaning violations only for attributed customers and non-tank products', function (): void {
|
|
$washProduct = [
|
|
'product_category' => 4,
|
|
'product_name' => 'Forvogn',
|
|
'category_name' => 'Udvendig',
|
|
];
|
|
$tankCleaningProduct = [
|
|
'product_category' => 5,
|
|
'product_name' => 'Tank cleaning 4 spulehoveder',
|
|
'category_name' => 'Tank cleaning',
|
|
];
|
|
|
|
expect(customer_order_product_policy::onlyTankCleaningViolation(true, $washProduct))->toBeTrue()
|
|
->and(customer_order_product_policy::onlyTankCleaningViolation(true, $tankCleaningProduct))->toBeFalse()
|
|
->and(customer_order_product_policy::onlyTankCleaningViolation(false, $washProduct))->toBeFalse();
|
|
});
|