Inheritance: extends Service
Exemple #1
0
 public function testIsRetireShouldReturnFalse()
 {
     $this->userRoleCriteria->shouldReceive('getByUserId')->andReturn(null);
     $service = new UserRoleService($this->userRoleCriteria);
     $this->assertFalse($service->isRetire(1235));
     $this->userRoleCriteria->shouldReceive('getByUserId')->andReturn((object) ['name' => 'オーナー']);
     $service = new UserRoleService($this->userRoleCriteria);
     $this->assertFalse($service->isRetire(1235));
 }
Exemple #2
0
 /**
  * 記事が編集された時
  *
  * @param EditEvent  $event
  */
 public function onItemEdited(EditEvent $event)
 {
     $item = $this->itemService->getByOpenItemId($event->getId());
     $recipient = $this->userService->getById($item->user_id);
     $sender = $this->userService->getById($event->getUserId());
     if ($this->userRoleService->isRetire($recipient->id)) {
         return false;
     }
     if ($this->areUsersSame($recipient, $sender)) {
         return false;
     } elseif (!$this->notificationIsEnabled('edit', $recipient->id)) {
         return false;
     }
     $this->mail->send('emails.action.edit', $this->getDataForMail($item, $recipient, $sender), function ($m) use($recipient, $sender) {
         $m->to($recipient->email)->subject('あなたの記事が' . $sender->username . 'さんに編集されました - Owl');
     });
 }