mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Merge pull request #15286 from marcusmoore/test-updates
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
Implemented artisan test case
This commit is contained in:
commit
74e7b1cfa5
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Tests\Feature;
|
namespace Tests\Feature\Console;
|
||||||
|
|
||||||
use App\Models\Asset;
|
use App\Models\Asset;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
@ -10,7 +10,6 @@ class FixupAssignedToAssignedTypeTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testEmptyAssignedType()
|
public function testEmptyAssignedType()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
|
||||||
$asset = Asset::factory()->create();
|
$asset = Asset::factory()->create();
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
$admin = User::factory()->admin()->create();
|
$admin = User::factory()->admin()->create();
|
||||||
|
@ -18,15 +17,10 @@ class FixupAssignedToAssignedTypeTest extends TestCase
|
||||||
$asset->checkOut($user, $admin);
|
$asset->checkOut($user, $admin);
|
||||||
$asset->assigned_type=null; //blank out the assigned type
|
$asset->assigned_type=null; //blank out the assigned type
|
||||||
$asset->save();
|
$asset->save();
|
||||||
print "Okay we set everything up~!!!\n";
|
|
||||||
|
|
||||||
$output = $this->artisan('snipeit:assigned-to-fixup --debug')->assertExitCode(0);
|
$this->artisan('snipeit:assigned-to-fixup --debug')->assertExitCode(0);
|
||||||
print "artisan ran!\n";
|
|
||||||
dump($output);
|
$this->assertEquals(User::class, $asset->fresh()->assigned_type);
|
||||||
$asset = Asset::find($asset->id);
|
|
||||||
print "\n we refreshed the asset?";
|
|
||||||
dump($asset);
|
|
||||||
$this->assertEquals(User::class, $asset->assigned_type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInvalidAssignedTo()
|
public function testInvalidAssignedTo()
|
||||||
|
@ -37,21 +31,15 @@ class FixupAssignedToAssignedTypeTest extends TestCase
|
||||||
$admin = User::factory()->admin()->create();
|
$admin = User::factory()->admin()->create();
|
||||||
|
|
||||||
$asset->checkOut($user, $admin);
|
$asset->checkOut($user, $admin);
|
||||||
// $asset->checkIn($user, $admin); //no such method btw
|
|
||||||
$asset->assigned_type=null;
|
$asset->assigned_type=null;
|
||||||
$asset->assigned_to=null;
|
$asset->assigned_to=null;
|
||||||
$asset->saveOrFail(); //*should* generate a 'checkin'?
|
$asset->saveOrFail(); //*should* generate a 'checkin'?
|
||||||
|
|
||||||
$asset->assigned_to=$user->id; //incorrectly mark asset as partially checked-out
|
$asset->assigned_to=$user->id; //incorrectly mark asset as partially checked-out
|
||||||
$asset->saveOrFail();
|
$asset->saveOrFail();
|
||||||
print "Okay we set everything up for test TWO~!!!\n";
|
|
||||||
|
|
||||||
$output = $this->artisan('snipeit:assigned-to-fixup --debug')->assertExitCode(0);
|
$this->artisan('snipeit:assigned-to-fixup --debug')->assertExitCode(0);
|
||||||
print "artisan ran TWO!\n";
|
|
||||||
dump($output);
|
$this->assertNull($asset->fresh()->assigned_to);
|
||||||
$asset = Asset::find($asset->id);
|
|
||||||
print "\n we refreshed the asset?";
|
|
||||||
dump($asset);
|
|
||||||
$this->assertNull($asset->assigned_to);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue