Esempio n. 1
0
 /**
  * @dataProvider dataSetPrimary
  * @param bool $primary
  */
 public function testSetPrimary($primary)
 {
     $this->assertSame(false, $this->action->isPrimary());
     $this->assertSame($this->action, $this->action->setPrimary($primary));
     $this->assertSame($primary, $this->action->isPrimary());
 }
Esempio n. 2
0
 /**
  * @param IAction $action
  * @return $this
  * @throws \InvalidArgumentException if the action are invalid
  * @since 8.2.0
  */
 public function addParsedAction(IAction $action)
 {
     if (!$action->isValidParsed()) {
         throw new \InvalidArgumentException('The given parsed action is invalid');
     }
     if ($action->isPrimary()) {
         if ($this->hasPrimaryParsedAction) {
             throw new \InvalidArgumentException('The notification already has a primary action');
         }
         $this->hasPrimaryParsedAction = true;
     }
     $this->actionsParsed[] = $action;
     return $this;
 }
 /**
  * @param IAction $action
  * @return array
  */
 protected function actionToArray(IAction $action)
 {
     return ['label' => $action->getParsedLabel(), 'link' => $action->getLink(), 'type' => $action->getRequestType(), 'primary' => $action->isPrimary()];
 }