Exemple #1
0
 /**
  * @ZF-7703
  */
 public function testLocaleDetectsNoEnglishLocaleOnOtherSetLocale()
 {
     Locale::setDefault('de');
     $valid = new IntValidator();
     $this->assertTrue($valid->isValid(1200));
     $this->assertFalse($valid->isValid('1,200'));
 }
Exemple #2
0
 /**
  * Validate Group Search Options
  *
  * @param  array $options
  * @throws Exception\DomainException
  * @return void
  */
 protected function validateGroupPoolGetPhotos(array $options)
 {
     $validOptions = array('api_key', 'tags', 'method', 'group_id', 'per_page', 'page', 'extras', 'user_id');
     $this->compareOptions($options, $validOptions);
     $between = new BetweenValidator(1, 500, true);
     if (!$between->isValid($options['per_page'])) {
         throw new Exception\DomainException($options['per_page'] . ' is not valid for the "per_page" option');
     }
     $int = new IntValidator();
     $int->setLocale('en');
     if (!$int->isValid($options['page'])) {
         throw new Exception\DomainException($options['page'] . ' is not valid for the "page" option');
     }
     // validate extras, which are delivered in csv format
     if (isset($options['extras'])) {
         $extras = explode(',', $options['extras']);
         $validExtras = array('license', 'date_upload', 'date_taken', 'owner_name', 'icon_server');
         foreach ($extras as $extra) {
             /**
              * @todo The following does not do anything [yet], so it is commented out.
              */
             //in_array(trim($extra), $validExtras);
         }
     }
 }