public function testParameterBag()
 {
     $parameter = new ParameterBag(array('first_name' => 'Johan', 'last_name' => 'Tanaka'));
     $this->assertContains('Johan', $parameter->all());
     $this->assertContains('Tanaka', $parameter->values());
     $this->assertContains('first_name', $parameter->keys());
     $email = $parameter->filter('email', FILTER_VALIDATE_EMAIL, '*****@*****.**');
     $this->assertSame('*****@*****.**', $email);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function set($key, $value)
 {
     if (false === is_array($value) && false === $value instanceof UploadedFile) {
         throw new InvalidArgumentException(sprintf('Uploaded file should be an array or instance of "%s", "%s" given.', 'Borobudur\\Http\\File\\UploadedFile', gettype($value)));
     }
     return parent::set($key, $this->convertToFile($value));
 }