本文整理匯總了PHP中UserRepository::shouldReceive方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserRepository::shouldReceive方法的具體用法?PHP UserRepository::shouldReceive怎麽用?PHP UserRepository::shouldReceive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserRepository
的用法示例。
在下文中一共展示了UserRepository::shouldReceive方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: should_register_new_user
/** @test */
public function should_register_new_user()
{
$this->repository->shouldReceive('userOfEmail')->once()->andReturn(null);
$this->repository->shouldReceive('userOfUsername')->once()->andReturn(null);
$this->repository->shouldReceive('nextIdentity')->once()->andReturn(UserId::generate());
$this->repository->shouldReceive('add')->once();
$user = $this->service->register('name@domain.com', 'username', 'password');
$this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\User', $user);
}
示例2: should_allow_user_to_join_the_group
/** @test */
public function should_allow_user_to_join_the_group()
{
$user = m::mock('Cribbb\\Domain\\Model\\Identity\\User');
$group = m::mock('Cribbb\\Domain\\Model\\Groups\\Group');
$group->shouldReceive('addMember')->once();
$this->users->shouldReceive('userById')->once()->andReturn($user);
$this->groups->shouldReceive('groupById')->once()->andReturn($group);
$group = $this->service->join('7c5e8127-3f77-496c-9bb4-5cb092969d89', 'a3d9e532-0ea8-4572-8e83-119fc49e4c6f');
$this->assertInstanceOf('Cribbb\\Domain\\Model\\Groups\\Group', $group);
}
示例3: should_register_new_user
/** @test */
public function should_register_new_user()
{
$this->repository->shouldReceive('userOfEmail')->andReturn(null);
$this->repository->shouldReceive('userOfUsername')->andReturn(null);
$this->repository->shouldReceive('nextIdentity')->andReturn($this->uuid);
$this->hashing->shouldReceive('hash')->andReturn($this->password);
$this->repository->shouldReceive('add');
$this->dispatcher->shouldReceive('dispatch');
$user = $this->service->registerUser('name@domain.com', 'username', 'password');
$this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\User', $user);
}
示例4: should_reset_password_and_return_user
/** @test */
public function should_reset_password_and_return_user()
{
$reminder = new Reminder($this->fixture['id'], $this->fixture['email'], $this->fixture['code']);
$this->reminders->shouldReceive('findReminderByEmailAndCode')->andReturn($reminder);
$this->users->shouldReceive('userOfEmail')->andReturn($this->user);
$this->hasher->shouldReceive('hash')->andReturn(new HashedPassword('qwerty123'));
$this->users->shouldReceive('update');
$this->reminders->shouldReceive('deleteReminderByCode');
$user = $this->service->reset('name@domain.com', 'qwerty123', 'abc123');
$this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\User', $user);
}
示例5: should_create_new_thread
/** @test */
public function should_create_new_thread()
{
$user = m::mock('Cribbb\\Domain\\Model\\Identity\\User');
$group = m::mock('Cribbb\\Domain\\Model\\Groups\\Group');
$thread = m::mock('Cribbb\\Domain\\Model\\Discussion\\Thread');
$this->users->shouldReceive('userById')->once()->andReturn($user);
$this->groups->shouldReceive('groupById')->once()->andReturn($group);
$group->shouldReceive('startNewThread')->once()->andReturn($thread);
$this->threads->shouldReceive('add')->once();
$thread = $this->service->create('7c5e8127-3f77-496c-9bb4-5cb092969d89', 'a3d9e532-0ea8-4572-8e83-119fc49e4c6f', 'Hello World');
$this->assertInstanceOf('Cribbb\\Domain\\Model\\Discussion\\Thread', $thread);
}
示例6: should_create_new_post
/** @test */
public function should_create_new_post()
{
$user = m::mock('Cribbb\\Domain\\Model\\Identity\\User');
$thread = m::mock('Cribbb\\Domain\\Model\\Discussion\\Thread');
$post = m::mock('Cribbb\\Domain\\Model\\Discussion\\Post');
$this->users->shouldReceive('userById')->once()->andReturn($user);
$this->threads->shouldReceive('threadById')->once()->andReturn($thread);
$thread->shouldReceive('createNewPost')->once()->andReturn($post);
$this->posts->shouldReceive('add')->once();
$post = $this->service->create('7c5e8127-3f77-496c-9bb4-5cb092969d89', 'a3d9e532-0ea8-4572-8e83-119fc49e4c6f', 'Hello World');
$this->assertInstanceOf('Cribbb\\Domain\\Model\\Discussion\\Post', $post);
}
示例7: should_reset_password_and_return_user
/** @test */
public function should_reset_password_and_return_user()
{
$reminder = m::mock('Cribbb\\Domain\\Model\\Identity\\Reminder');
$reminder->shouldReceive('isValid')->andReturn(true);
$this->reminders->shouldReceive('findReminderByEmailAndCode')->andReturn($reminder);
$user = m::mock('Cribbb\\Domain\\Model\\Identity\\User');
$this->users->shouldReceive('userOfEmail')->once()->andReturn($user);
$user->shouldReceive('resetPassword')->once();
$this->users->shouldReceive('update')->once();
$this->reminders->shouldReceive('deleteReminderByCode')->once();
$user = $this->service->reset('name@domain.com', 'password', 'abc123');
$this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\User', $user);
}
示例8: should_return_false_when_not_unique
/** @test */
public function should_return_false_when_not_unique()
{
$this->repository->shouldReceive('userOfUsername')->andReturn(['id' => 1]);
$this->assertFalse($this->spec->isSatisfiedBy(new Username('philipbrown')));
}
示例9: should_return_false_when_not_unique
/** @test */
public function should_return_false_when_not_unique()
{
$this->repository->shouldReceive('userOfEmail')->andReturn(['id' => 1]);
$this->assertFalse($this->spec->isSatisfiedBy(new Email('name@domain.com')));
}