コード例 #1
0
ファイル: EnumNormalizer.php プロジェクト: Maksold/platform
 /**
  * @param AbstractEnumValue $object
  *
  * {@inheritdoc}
  */
 public function normalize($object, $format = null, array $context = [])
 {
     if (!$object instanceof AbstractEnumValue) {
         return null;
     }
     if (!empty($context['mode']) && $context['mode'] === 'short') {
         return ['id' => $object->getId()];
     }
     return ['id' => $object->getId(), 'name' => $object->getName(), 'priority' => (int) $object->getPriority(), 'is_default' => (bool) $object->isDefault()];
 }
コード例 #2
0
 /**
  * @param Crawler           $crawler
  * @param string            $name
  * @param Account           $parent
  * @param AccountGroup      $group
  * @param AbstractEnumValue $internalRating
  */
 protected function assertAccountSave(Crawler $crawler, $name, Account $parent, AccountGroup $group, AbstractEnumValue $internalRating)
 {
     $form = $crawler->selectButton('Save and Close')->form(['orob2b_account_type[name]' => $name, 'orob2b_account_type[parent]' => $parent->getId(), 'orob2b_account_type[group]' => $group->getId(), 'orob2b_account_type[internal_rating]' => $internalRating->getId()]);
     $this->client->followRedirects(true);
     $crawler = $this->client->submit($form);
     $result = $this->client->getResponse();
     $this->assertHtmlResponseStatusCodeEquals($result, 200);
     $html = $crawler->html();
     $this->assertContains('Account has been saved', $html);
     $this->assertViewPage($html, $name, $parent, $group, $internalRating);
 }