mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
Merge pull request #15290 from marcusmoore/test-fixes
Some checks are pending
Crowdin Action / upload-sources-to-crowdin (push) Waiting to run
Docker images (Alpine) / docker (push) Waiting to run
Docker images / docker (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Waiting to run
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Waiting to run
Some checks are pending
Crowdin Action / upload-sources-to-crowdin (push) Waiting to run
Docker images (Alpine) / docker (push) Waiting to run
Docker images / docker (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Waiting to run
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Waiting to run
Fixed component check in test
This commit is contained in:
commit
7a6a2e3d92
|
@ -4,27 +4,35 @@ namespace Tests\Feature\Checkins\Ui;
|
||||||
|
|
||||||
use App\Models\Component;
|
use App\Models\Component;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class ComponentCheckinTest extends TestCase
|
class ComponentCheckinTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testCheckingInComponentRequiresCorrectPermission()
|
public function testCheckingInComponentRequiresCorrectPermission()
|
||||||
{
|
{
|
||||||
|
$component = Component::factory()->checkedOutToAsset()->create();
|
||||||
|
|
||||||
|
$componentAsset = DB::table('components_assets')->where('component_id', $component->id)->first();
|
||||||
|
|
||||||
$this->actingAs(User::factory()->create())
|
$this->actingAs(User::factory()->create())
|
||||||
->post(route('components.checkin.store', [
|
->post(route('components.checkin.store', [
|
||||||
'componentID' => Component::factory()->checkedOutToAsset()->create()->id,
|
'componentID' => $componentAsset->id,
|
||||||
]))
|
]))
|
||||||
->assertForbidden();
|
->assertForbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex()
|
public function testComponentCheckinPagePostIsRedirectedIfRedirectSelectionIsIndex()
|
||||||
{
|
{
|
||||||
$component = Component::factory()->checkedOutToAsset()->create();
|
$component = Component::factory()->checkedOutToAsset()->create();
|
||||||
|
|
||||||
|
$componentAsset = DB::table('components_assets')->where('component_id', $component->id)->first();
|
||||||
|
|
||||||
$this->actingAs(User::factory()->admin()->create())
|
$this->actingAs(User::factory()->admin()->create())
|
||||||
->from(route('components.index'))
|
->from(route('components.index'))
|
||||||
->post(route('components.checkin.store', $component), [
|
->post(route('components.checkin.store', [
|
||||||
|
'componentID' => $componentAsset->id,
|
||||||
|
]), [
|
||||||
'redirect_option' => 'index',
|
'redirect_option' => 'index',
|
||||||
'checkin_qty' => 1,
|
'checkin_qty' => 1,
|
||||||
])
|
])
|
||||||
|
@ -36,9 +44,13 @@ class ComponentCheckinTest extends TestCase
|
||||||
{
|
{
|
||||||
$component = Component::factory()->checkedOutToAsset()->create();
|
$component = Component::factory()->checkedOutToAsset()->create();
|
||||||
|
|
||||||
|
$componentAsset = DB::table('components_assets')->where('component_id', $component->id)->first();
|
||||||
|
|
||||||
$this->actingAs(User::factory()->admin()->create())
|
$this->actingAs(User::factory()->admin()->create())
|
||||||
->from(route('components.index'))
|
->from(route('components.index'))
|
||||||
->post(route('components.checkin.store', $component), [
|
->post(route('components.checkin.store', [
|
||||||
|
'componentID' => $componentAsset->id,
|
||||||
|
]), [
|
||||||
'redirect_option' => 'item',
|
'redirect_option' => 'item',
|
||||||
'checkin_qty' => 1,
|
'checkin_qty' => 1,
|
||||||
])
|
])
|
||||||
|
@ -46,6 +58,4 @@ class ComponentCheckinTest extends TestCase
|
||||||
->assertSessionHasNoErrors()
|
->assertSessionHasNoErrors()
|
||||||
->assertRedirect(route('components.show', ['component' => $component->id]));
|
->assertRedirect(route('components.show', ['component' => $component->id]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue