Owl\Handlers\Events\SlackNotification::onItemEdited PHP Метод

onItemEdited() публичный Метод

記事が編集された時
public onItemEdited ( Owl\Events\Item\EditEvent $event )
$event Owl\Events\Item\EditEvent
    public function onItemEdited(EditEvent $event)
    {
        $item = $this->itemService->getByOpenItemId($event->getId());
        if (!$this->itemShouldNotified($item)) {
            return;
        }
        $user = $this->userService->getById($event->getUserId());
        $this->slackUtils->postEditMessage($item, $user);
    }

Usage Example

Пример #1
0
 /**
  * 限定公開記事は通知されない
  */
 public function testShouldNotNotifyWhenItemIsNotPublishedAndLimitation()
 {
     $this->itemRepo->shouldReceive('getByOpenItemId')->andReturn($this->createMockItem("1"));
     $this->userRepo->shouldReceive('getById')->andReturn($this->dummyUser);
     $this->slackUtilMock->shouldNotReceive('postEditMessage');
     $this->slackUtilMock->shouldNotReceive('postCreateMessage');
     $editEvent = new EditEvent('itemId', 'userId');
     $this->handler->onItemEdited($editEvent);
     $createEvent = new CreateEvent('itemId', 'userId');
     $this->handler->onItemCreated($createEvent);
 }