Пример #1
0
 public function testPassWithoutIcon()
 {
     self::assertArrayNotHasKey('icon', $this->pass->getImages(), 'pass must not have an icon for test to be valid');
     $this->assertFails($this->pass, PassValidator::ICON_REQUIRED);
     $icon = new Image(__DIR__ . '/../../img/icon.png', 'icon');
     $this->pass->addImage($icon);
     $this->assertPasses($this->pass, PassValidator::ICON_REQUIRED);
 }
Пример #2
0
 private function validateImages(Pass $pass)
 {
     $images = $pass->getImages();
     foreach ($images as $image) {
         /* @var Image $image */
         if ($image->getContext() === 'icon') {
             return;
         }
     }
     $this->addError(self::ICON_REQUIRED);
 }