Refactoring code snippet for test suite

Posted 1 year ago by xtremer360

I'm trying to figure out how I can better refactor this section in my code because it is located in every test file in my test suite. The only difference is the the slug is different for the permission.

Any ideas?

public function setUp()

    $this->user = factory(User::class)->create();
    $this->role = factory(Role::class)->create(['slug' => 'admin']);
    $this->permission = factory(Permission::class)->create(['slug' => 'slug-here']);


Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.