Exemplo n.º 1
0
 public function indexAction()
 {
     $user = $this->auth->getUser();
     $error = false;
     if ($this->params()->fromPost('confirm')) {
         if ($this->dependencies->removeItems($user)) {
             $this->auth->clearIdentity();
             $user->setStatus(Status::INACTIVE);
             return $this->redirect()->toRoute('lang');
         } else {
             $error = true;
         }
     }
     return ['lists' => $this->dependencies->getLists(), 'user' => $user, 'limit' => 20, 'error' => $error];
 }
Exemplo n.º 2
0
 /**
  * @covers ::attachDefaultListeners
  */
 public function testDefaultListenersAreCalled()
 {
     $user = $this->getMockBuilder(User::class)->getMock();
     $this->events = new EventManager();
     $item = new \stdClass();
     $items = [$item];
     $list = $this->getMockBuilder(ListInterface::class)->getMock();
     $list->expects($this->once())->method('getEntities')->with($this->equalTo($user))->willReturn($items);
     $this->manager = $this->getMockBuilder(Manager::class)->setConstructorArgs([$this->documentManager])->setMethods(['getLists'])->getMock();
     $this->manager->expects($this->once())->method('getLists')->willReturn([$list]);
     $this->manager->setEventManager($this->events);
     $this->documentManager->expects($this->once())->method('remove')->with($this->equalTo($item));
     $this->assertTrue($this->manager->removeItems($user));
 }