157 lines
3.9 KiB
PHP
157 lines
3.9 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Models;
|
|
|
|
use Tests\TestCase;
|
|
use App\Models\User;
|
|
use App\Models\Label;
|
|
use App\Models\Gender;
|
|
use App\Models\Module;
|
|
use App\Models\Account;
|
|
use App\Models\Pronoun;
|
|
use App\Models\Template;
|
|
use App\Models\GroupType;
|
|
use App\Models\AddressType;
|
|
use App\Models\Information;
|
|
use App\Models\PetCategory;
|
|
use App\Models\RelationshipGroupType;
|
|
use App\Models\ContactInformationType;
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
class AccountTest extends TestCase
|
|
{
|
|
use DatabaseTransactions;
|
|
|
|
/** @test */
|
|
public function it_has_many_users()
|
|
{
|
|
$account = Account::factory()->create();
|
|
User::factory()->count(2)->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$this->assertTrue($account->users()->exists());
|
|
}
|
|
|
|
/** @test */
|
|
public function it_has_many_templates()
|
|
{
|
|
$account = Account::factory()->create();
|
|
Template::factory(2)->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$this->assertTrue($account->templates()->exists());
|
|
}
|
|
|
|
/** @test */
|
|
public function it_has_many_modules()
|
|
{
|
|
$account = Account::factory()->create();
|
|
Module::factory(2)->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$this->assertTrue($account->modules()->exists());
|
|
}
|
|
|
|
/** @test */
|
|
public function it_has_many_informations()
|
|
{
|
|
$account = Account::factory()->create();
|
|
Information::factory(2)->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$this->assertTrue($account->informations()->exists());
|
|
}
|
|
|
|
/** @test */
|
|
public function it_has_many_group_types()
|
|
{
|
|
$account = Account::factory()->create();
|
|
GroupType::factory(2)->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$this->assertTrue($account->groupTypes()->exists());
|
|
}
|
|
|
|
/** @test */
|
|
public function it_has_many_relationship_group_types()
|
|
{
|
|
$account = Account::factory()->create();
|
|
RelationshipGroupType::factory(2)->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$this->assertTrue($account->relationshipGroupTypes()->exists());
|
|
}
|
|
|
|
/** @test */
|
|
public function it_has_many_genders()
|
|
{
|
|
$account = Account::factory()->create();
|
|
Gender::factory(2)->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$this->assertTrue($account->genders()->exists());
|
|
}
|
|
|
|
/** @test */
|
|
public function it_has_many_pronouns()
|
|
{
|
|
$account = Account::factory()->create();
|
|
Pronoun::factory(2)->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$this->assertTrue($account->pronouns()->exists());
|
|
}
|
|
|
|
/** @test */
|
|
public function it_has_many_labels()
|
|
{
|
|
$account = Account::factory()->create();
|
|
Label::factory(2)->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$this->assertTrue($account->labels()->exists());
|
|
}
|
|
|
|
/** @test */
|
|
public function it_has_many_contact_information_types()
|
|
{
|
|
$account = Account::factory()->create();
|
|
ContactInformationType::factory(2)->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$this->assertTrue($account->contactInformationTypes()->exists());
|
|
}
|
|
|
|
/** @test */
|
|
public function it_has_many_address_types()
|
|
{
|
|
$account = Account::factory()->create();
|
|
AddressType::factory(2)->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$this->assertTrue($account->addressTypes()->exists());
|
|
}
|
|
|
|
/** @test */
|
|
public function it_has_many_pet_categories()
|
|
{
|
|
$account = Account::factory()->create();
|
|
PetCategory::factory(2)->create([
|
|
'account_id' => $account->id,
|
|
]);
|
|
|
|
$this->assertTrue($account->petCategories()->exists());
|
|
}
|
|
}
|