mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Beginning of CompanyTest fixes (not done yet)
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
064e0b7a1c
commit
9536f836f0
|
@ -6,7 +6,9 @@ use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||||
use Tests\Unit\BaseTest;
|
use Tests\Unit\BaseTest;
|
||||||
use App\Models\Company;
|
use App\Models\Component;
|
||||||
|
use App\Models\Asset;
|
||||||
|
use App\Models\Consumable;
|
||||||
|
|
||||||
class CompanyTest extends BaseTest
|
class CompanyTest extends BaseTest
|
||||||
{
|
{
|
||||||
|
@ -32,21 +34,21 @@ class CompanyTest extends BaseTest
|
||||||
|
|
||||||
public function testACompanyCanHaveUsers()
|
public function testACompanyCanHaveUsers()
|
||||||
{
|
{
|
||||||
$company = Category::factory()->assetDesktopCategory()->create();
|
$company = Company::factory()->assetDesktopCategory()->create();
|
||||||
$user = $this->createValidUser(['company_id'=>$company->id]);
|
$user = $this->createValidUser(['company_id'=>$company->id]);
|
||||||
$this->assertCount(1, $company->users);
|
$this->assertCount(1, $company->users);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testACompanyCanHaveAssets()
|
public function testACompanyCanHaveAssets()
|
||||||
{
|
{
|
||||||
$company = $this->createValidCompany();
|
$company = Company::factory()->assetDesktopCategory()->create();
|
||||||
$this->createValidAsset(['company_id' => $company->id]);
|
$this->createValidAsset(['company_id' => $company->id]);
|
||||||
$this->assertCount(1, $company->assets);
|
$this->assertCount(1, $company->assets);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testACompanyCanHaveLicenses()
|
public function testACompanyCanHaveLicenses()
|
||||||
{
|
{
|
||||||
$company = $this->createValidCompany();
|
$company = Company::factory()->assetDesktopCategory()->create();
|
||||||
\App\Models\License::factory()->count(1)->acrobat()->create([
|
\App\Models\License::factory()->count(1)->acrobat()->create([
|
||||||
'company_id'=>$company->id,
|
'company_id'=>$company->id,
|
||||||
'manufacturer_id' => \App\Models\Manufacturer::factory()->adobe()->create()->id,
|
'manufacturer_id' => \App\Models\Manufacturer::factory()->adobe()->create()->id,
|
||||||
|
@ -57,7 +59,7 @@ class CompanyTest extends BaseTest
|
||||||
|
|
||||||
public function testACompanyCanHaveAccessories()
|
public function testACompanyCanHaveAccessories()
|
||||||
{
|
{
|
||||||
$company = $this->createValidCompany();
|
$company = Company::factory()->assetDesktopCategory()->create();
|
||||||
$a = \App\Models\Accessory::factory()->appleBtKeyboard()->create([
|
$a = \App\Models\Accessory::factory()->appleBtKeyboard()->create([
|
||||||
'category_id' => \App\Models\Category::factory()->accessoryKeyboardCategory()->create()->id,
|
'category_id' => \App\Models\Category::factory()->accessoryKeyboardCategory()->create()->id,
|
||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
|
@ -68,7 +70,7 @@ class CompanyTest extends BaseTest
|
||||||
|
|
||||||
public function testACompanyCanHaveConsumables()
|
public function testACompanyCanHaveConsumables()
|
||||||
{
|
{
|
||||||
$company = $this->createValidCompany();
|
$company = Company::factory()->assetDesktopCategory()->create();
|
||||||
\App\Models\Consumable::factory()->count(1)->cardstock()->create([
|
\App\Models\Consumable::factory()->count(1)->cardstock()->create([
|
||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
'category_id' => \App\Models\Category::factory()->consumablePaperCategory()->create()->id,
|
'category_id' => \App\Models\Category::factory()->consumablePaperCategory()->create()->id,
|
||||||
|
@ -78,8 +80,8 @@ class CompanyTest extends BaseTest
|
||||||
|
|
||||||
public function testACompanyCanHaveComponents()
|
public function testACompanyCanHaveComponents()
|
||||||
{
|
{
|
||||||
$company = $this->createValidCompany();
|
$company = Company::factory()->assetDesktopCategory()->create();
|
||||||
\App\Models\Component::factory()->count(1)->ramCrucial4()->create([
|
Component::factory()->count(1)->ramCrucial4()->create([
|
||||||
'company_id'=>$company->id,
|
'company_id'=>$company->id,
|
||||||
'category_id' => \App\Models\Category::factory()->componentRamCategory()->create()->id,
|
'category_id' => \App\Models\Category::factory()->componentRamCategory()->create()->id,
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in a new issue