Stub out test
This commit is contained in:
parent
a6bcd3c0c2
commit
607f29030f
1 changed files with 27 additions and 1 deletions
|
@ -2,11 +2,14 @@
|
||||||
|
|
||||||
namespace Tests\Feature\Accessories\Api;
|
namespace Tests\Feature\Accessories\Api;
|
||||||
|
|
||||||
|
use App\Models\Category;
|
||||||
|
use App\Models\Company;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Tests\Concerns\TestsFullMultipleCompaniesSupport;
|
||||||
use Tests\Concerns\TestsPermissionsRequirement;
|
use Tests\Concerns\TestsPermissionsRequirement;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class StoreAccessoryTest extends TestCase implements TestsPermissionsRequirement
|
class StoreAccessoryTest extends TestCase implements TestsFullMultipleCompaniesSupport, TestsPermissionsRequirement
|
||||||
{
|
{
|
||||||
public function testRequiresPermission()
|
public function testRequiresPermission()
|
||||||
{
|
{
|
||||||
|
@ -15,6 +18,29 @@ class StoreAccessoryTest extends TestCase implements TestsPermissionsRequirement
|
||||||
->assertForbidden();
|
->assertForbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAdheresToFullMultipleCompaniesSupportScoping()
|
||||||
|
{
|
||||||
|
$this->markTestSkipped('This behavior is not implemented');
|
||||||
|
|
||||||
|
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||||
|
$userInCompanyA = User::factory()->for($companyA)->createAccessories()->create();
|
||||||
|
|
||||||
|
$this->settings->enableMultipleFullCompanySupport();
|
||||||
|
|
||||||
|
// attempt to store an accessory for company B
|
||||||
|
$this->actingAsForApi($userInCompanyA)
|
||||||
|
->postJson(route('api.accessories.store'), [
|
||||||
|
'category_id' => Category::factory()->forAccessories()->create()->id,
|
||||||
|
'name' => 'Accessory A',
|
||||||
|
'qty' => 1,
|
||||||
|
'company_id' => $companyB->id,
|
||||||
|
])->assertStatusMessageIs('error');
|
||||||
|
|
||||||
|
$this->assertDatabaseMissing('accessories', [
|
||||||
|
'name' => 'Accessory A',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function testValidation()
|
public function testValidation()
|
||||||
{
|
{
|
||||||
$this->actingAsForApi(User::factory()->createAccessories()->create())
|
$this->actingAsForApi(User::factory()->createAccessories()->create())
|
||||||
|
|
Loading…
Add table
Reference in a new issue