Exemplo n.º 1
0
 /**
  * @param int $accountId
  */
 public function delete($currentUserId, $accountId)
 {
     if ((int) $accountId === UnifiedAccount::ID) {
         return;
     }
     $mailAccount = $this->mapper->find($currentUserId, $accountId);
     $this->mapper->delete($mailAccount);
 }
Exemplo n.º 2
0
 public function testFind()
 {
     /** @var MailAccount $b */
     $b = $this->mapper->insert($this->account);
     $result = $this->mapper->find($b->getUserId(), $b->getId());
     $this->assertEquals($b->toJson(), $result->toJson());
     $result = $this->mapper->findByUserId($b->getUserId());
     $c = array_filter($result, function ($a) use($b) {
         /** @var MailAccount $a */
         return $a->getId() === $b->getId();
     });
     $c = array_pop($c);
     $this->assertEquals($b->toJson(), $c->toJson());
 }