You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
<?php
|
|
|
|
namespace Tests\Unit\Policies;
|
|
|
|
use App\Entities\Partners\Vendor;
|
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
|
use Tests\TestCase as TestCase;
|
|
|
|
class VendorPolicyTest extends TestCase
|
|
{
|
|
use DatabaseMigrations;
|
|
|
|
/** @test */
|
|
public function user_can_create_vendor()
|
|
{
|
|
$user = $this->adminUserSigningIn();
|
|
$this->assertTrue($user->can('create', new Vendor));
|
|
}
|
|
|
|
/** @test */
|
|
public function user_can_view_vendor()
|
|
{
|
|
$user = $this->adminUserSigningIn();
|
|
$vendor = factory(Vendor::class)->create(['name' => 'Vendor 1 name']);
|
|
$this->assertTrue($user->can('view', $vendor));
|
|
}
|
|
|
|
/** @test */
|
|
public function user_can_update_vendor()
|
|
{
|
|
$user = $this->adminUserSigningIn();
|
|
$vendor = factory(Vendor::class)->create(['name' => 'Vendor 1 name']);
|
|
$this->assertTrue($user->can('update', $vendor));
|
|
}
|
|
|
|
/** @test */
|
|
public function user_can_delete_vendor()
|
|
{
|
|
$user = $this->adminUserSigningIn();
|
|
$vendor = factory(Vendor::class)->create(['name' => 'Vendor 1 name']);
|
|
$this->assertTrue($user->can('delete', $vendor));
|
|
}
|
|
}
|