Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2. namespace Tests\Unit;
  3.  
  4. use App\Role;
  5. use App\User;
  6. use Illuminate\Foundation\Testing\RefreshDatabase;
  7. use Illuminate\Foundation\Testing\WithFaker;
  8. use Illuminate\Support\Facades\Schema;
  9. use Tests\TestCase;
  10.  
  11. class RolesTest extends TestCase
  12. {
  13. use RefreshDatabase, WithFaker;
  14.  
  15. /** @test */
  16. public function roles_database_has_expected_columns()
  17. {
  18. $this->assertTrue(
  19. Schema::hasColumns('roles', [
  20. 'id', 'title', 'description'
  21. ]), 1);
  22. }
  23.  
  24. /** @test */
  25. public function a_role_belongs_to_many_users()
  26. {
  27. $user = factory(User::class)->create();
  28. $role = factory(Role::class)->create();
  29.  
  30. $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $role->users);
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement