31 lines
1.1 KiB
PHP
31 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Business;
|
|
|
|
use Modules\EcommerceFinance\Services\SupplierFreeShippingStore;
|
|
use Tests\Feature\FeatureTestCase;
|
|
|
|
class SupplierFreeShippingStoreTest extends FeatureTestCase
|
|
{
|
|
public function test_marks_are_scoped_by_company_and_default_to_false(): void
|
|
{
|
|
$store = app(SupplierFreeShippingStore::class);
|
|
$companyId = (int) $this->company->id;
|
|
$store->save(9, true, $companyId, (int) $this->user->id, 'manual');
|
|
$store->save(11, false, $companyId, (int) $this->user->id, 'manual');
|
|
|
|
$rows = $store->decorateRows([
|
|
(object) ['Id' => 9],
|
|
(object) ['Id' => 11],
|
|
(object) ['Id' => 12],
|
|
], $companyId);
|
|
|
|
$this->assertTrue($rows[0]->free_shipping_manufacturer);
|
|
$this->assertFalse($rows[1]->free_shipping_manufacturer);
|
|
$this->assertFalse($rows[2]->free_shipping_manufacturer);
|
|
|
|
$otherCompanyRows = $store->decorateRows([(object) ['Id' => 9]], $companyId + 1);
|
|
$this->assertFalse($otherCompanyRows[0]->free_shipping_manufacturer);
|
|
}
|
|
}
|