37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
|
|
use App\Models\Product;
|
|
use App\Services\ProductOrderContext;
|
|
use Tests\TestCase;
|
|
|
|
uses(TestCase::class);
|
|
|
|
it('erlaubt Kunden-Shop show_on 3 für ot-customer ohne Abo', function () {
|
|
$product = new Product(['show_on' => ['3']]);
|
|
|
|
expect(ProductOrderContext::isProductAllowedInContext($product, false, 'ot-customer'))->toBeTrue();
|
|
});
|
|
|
|
it('lehnt reine Abo show_on 12 für ot-customer ohne Abo ab', function () {
|
|
$product = new Product(['show_on' => ['12']]);
|
|
|
|
expect(ProductOrderContext::isProductAllowedInContext($product, false, 'ot-customer'))->toBeFalse();
|
|
});
|
|
|
|
it('erlaubt Abo-Produkte für abo-ot-customer', function () {
|
|
$product = new Product(['show_on' => ['12']]);
|
|
|
|
expect(ProductOrderContext::isProductAllowedInContext($product, true, 'abo-ot-customer'))->toBeTrue();
|
|
});
|
|
|
|
it('erlaubt Berater-Shop show_on 2 für me ohne Abo', function () {
|
|
$product = new Product(['show_on' => ['2']]);
|
|
|
|
expect(ProductOrderContext::isProductAllowedInContext($product, false, 'me'))->toBeTrue();
|
|
});
|
|
|
|
it('mapped customer webshop wie ot-customer ohne Abo', function () {
|
|
$product = new Product(['show_on' => ['3']]);
|
|
|
|
expect(ProductOrderContext::isProductAllowedInCustomerWebshop($product))->toBeTrue();
|
|
});
|