當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserRepository::shouldReceive方法代碼示例

本文整理匯總了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);
 }
開發者ID:kfuchs,項目名稱:cribbb,代碼行數:10,代碼來源:UserRegistrationTest.php

示例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);
 }
開發者ID:kfuchs,項目名稱:cribbb,代碼行數:11,代碼來源:JoinGroupTest.php

示例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);
 }
開發者ID:snb4crazy,項目名稱:cribbb,代碼行數:12,代碼來源:IdentityApplicationServiceTest.php

示例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);
 }
開發者ID:kfuchs,項目名稱:cribbb,代碼行數:12,代碼來源:ReminderServiceTest.php

示例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);
 }
開發者ID:kfuchs,項目名稱:cribbb,代碼行數:13,代碼來源:NewThreadTest.php

示例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);
 }
開發者ID:kfuchs,項目名稱:cribbb,代碼行數:13,代碼來源:NewPostTest.php

示例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);
 }
開發者ID:kfuchs,項目名稱:cribbb,代碼行數:14,代碼來源:PasswordReminderTest.php

示例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')));
 }
開發者ID:alle,項目名稱:cribbb,代碼行數:6,代碼來源:UsernameIsUniqueTest.php

示例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')));
 }
開發者ID:alle,項目名稱:cribbb,代碼行數:6,代碼來源:EmailIsUniqueTest.php


注:本文中的UserRepository::shouldReceive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。