/** * Should create a non-staff user if the --staff option is not given. */ public function testDoesNotCreateStaffUserWithoutFlag() { $this->roleResource->expects($this->never())->method('mustFindByName'); $this->userResource->expects($this->never())->method('roles'); $tester = $this->commandTester($this->makeUser); $tester->execute([]); }
/** * Expect a user to be added to the staff role. */ private function expectStaffRoleAssociation() { $this->role->expects($this->atLeastOnce())->method('mustFindByName')->with(Role::STAFF)->willReturn($this->role); $usersRelationship = $this->makeMock(BelongsToMany::class); $this->role->expects($this->atLeastOnce())->method('users')->willReturn($usersRelationship); $usersRelationship->expects($this->atLeastOnce())->method('save')->with($this->isInstanceOf(User::class)); }