16 $visitor =
new Visitor();
17 $command = $this->getMockBuilder(
'Guzzle\Service\Command\AbstractCommand')
18 ->setMethods(array(
'getResponse'))
19 ->getMockForAbstractClass();
21 ->method(
'getResponse')
22 ->will($this->returnValue(
new Response(200,
null,
'{"foo":"bar"}')));
25 $this->assertEquals(array(
'foo' =>
'bar'), $result);
30 $visitor =
new Visitor();
35 'filters' =>
'strtoupper',
39 $this->value = array(
'foo' => array(
'a',
'b',
'c'));
40 $visitor->visit($this->command, $this->response, $param, $this->value);
41 $this->assertEquals(array(
'A',
'B',
'C'), $this->value[
'foo']);
46 $visitor =
new Visitor();
52 $this->value = array(
'Baz' =>
'test');
53 $visitor->visit($this->command, $this->response, $param, $this->value);
54 $this->assertEquals(array(
'foo' =>
'test'), $this->value);
59 $visitor =
new Visitor();
63 'properties' => array(
70 $this->value = array(
'foo' => array(
'unknown' =>
'Unknown'));
71 $visitor->visit($this->command, $this->response, $param, $this->value);
72 $this->assertEquals(array(
'foo' => array(
'unknown' =>
'Unknown')), $this->value);
77 $visitor =
new Visitor();
81 'properties' => array(
82 'foo' => array(
'filters' =>
'strtoupper'),
83 'bar' => array(
'filters' =>
'strtolower')
86 $this->value = array(
'foo' => array(
'foo' =>
'hello',
'bar' =>
'THERE'));
87 $visitor->visit($this->command, $this->response, $param, $this->value);
88 $this->assertEquals(array(
'foo' =>
'HELLO',
'bar' =>
'there'), $this->value[
'foo']);
97 $visitor =
new Visitor();
101 'additionalProperties' =>
false,
102 'properties' => array(
109 $this->value = array(
'foo' => array(
'bar' => 15,
'unknown' =>
'Unknown'));
110 $visitor->visit($this->command, $this->response, $param, $this->value);
111 $this->assertEquals(array(
'foo' => array(
'bar' => 15)), $this->value);
120 $visitor =
new Visitor();
124 'additionalProperties' =>
false,
125 'properties' => array(
132 $this->value = array(
'foo' => array(
'baz' => 15,
'unknown' =>
'Unknown'));
133 $visitor->visit($this->command, $this->response, $param, $this->value);
134 $this->assertEquals(array(
'foo' => array(
'bar' => 15)), $this->value);
139 $visitor =
new Visitor();
143 'additionalProperties' => array(
145 'properties' => array(
148 'filters' => array(
'base64_decode')
153 $this->value = array(
'foo' => array(
'baz' => array(
'bar' =>
'Zm9v')));
154 $visitor->visit($this->command, $this->response, $param, $this->value);
155 $this->assertEquals(
'foo', $this->value[
'foo'][
'baz'][
'bar']);