mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Add failing test
This commit is contained in:
parent
b83d148b37
commit
374812f8fe
|
@ -1,10 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\Checkins\Ui;
|
||||
namespace Tests\Feature\Checkouts\Ui;
|
||||
|
||||
use App\Events\CheckoutableCheckedOut;
|
||||
use App\Models\Asset;
|
||||
use App\Models\Company;
|
||||
use App\Models\Component;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ComponentsCheckoutTest extends TestCase
|
||||
|
@ -18,6 +21,30 @@ class ComponentsCheckoutTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testCannotCheckoutAcrossCompaniesWhenFullCompanySupportEnabled()
|
||||
{
|
||||
Event::fake([CheckoutableCheckedOut::class]);
|
||||
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
[$assetCompany, $componentCompany] = Company::factory()->count(2)->create();
|
||||
|
||||
$asset = Asset::factory()->for($assetCompany)->create();
|
||||
$component = Component::factory()->for($componentCompany)->create();
|
||||
|
||||
$this->actingAs(User::factory()->superuser()->create())
|
||||
->post(route('components.checkout.store', $component), [
|
||||
'asset_id' => $asset->id,
|
||||
'assigned_qty' => '1',
|
||||
// @todo:
|
||||
'note' => null,
|
||||
// @todo:
|
||||
'redirect_option' => 'index',
|
||||
]);
|
||||
|
||||
Event::assertNotDispatched(CheckoutableCheckedOut::class);
|
||||
}
|
||||
|
||||
public function testComponentCheckoutPagePostIsRedirectedIfRedirectSelectionIsIndex()
|
||||
{
|
||||
$component = Component::factory()->create();
|
||||
|
@ -63,6 +90,4 @@ class ComponentsCheckoutTest extends TestCase
|
|||
->assertStatus(302)
|
||||
->assertRedirect(route('hardware.show', ['hardware' => $asset]));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue