Esempio n. 1
0
 function inflatesPrimitiveValues()
 {
     $param = new Parameter('foo', new StringType());
     $this->assert($this->field->inflate($param, 'foo'), 'foo');
     $this->assert($this->field->inflate($param, ''), null);
     $this->assert($this->field->inflate($param, 'some <html>'), 'some <html>');
 }
Esempio n. 2
0
 function inflatesPrimitiveValues()
 {
     $param = new Parameter('foo', new IntegerType());
     $this->assert($this->field->inflate($param, '1A'), 1);
     $this->assert($this->field->inflate($param, ''), 0);
     $this->assert($this->field->inflate($param, 'foo'), 0);
 }
Esempio n. 3
0
 function inflatesList()
 {
     Mockster::stub($this->mockster->inflate(Argument::any(), Argument::any()))->will()->forwardTo(function (Parameter $p, $v) {
         return $p->getName() . '_' . $v;
     });
     $param = new Parameter('foo', new ArrayType(new StringType()));
     $this->assert($this->field->inflate($param, new Liste(['ignored', 'one', 'two'])), ['foo_one', 'foo_two']);
 }
Esempio n. 4
0
 function inflateValues()
 {
     M::stub($this->inside->inflate(Arg::any(), Arg::any()))->will()->forwardTo(function (Parameter $p, $v) {
         return $p->getName() . '_' . $v;
     });
     $this->assert($this->field->inflate($this->param('foo'), 'bar'), 'foo_bar');
     $this->assert($this->field->inflate($this->param('foo'), null), null);
     $this->assert($this->field->inflate($this->param('foo'), NullableField::NULL_VALUE), null);
 }
Esempio n. 5
0
 /**
  * @param Parameter $parameter
  * @param string $serialized
  * @return mixed
  */
 public function inflate(Parameter $parameter, $serialized)
 {
     $parameter = call_user_func($this->transformParameter, $parameter);
     $inflated = $this->field->inflate($parameter, $serialized);
     return call_user_func($this->afterInflate, $inflated);
 }