15 $visitor =
new Visitor();
17 $visitor->after($this->command, $this->request);
20 $visitor->visit($this->command, $this->request,
$param->setSentAs(
'test'),
'123');
21 $visitor->visit($this->command, $this->request,
$param->setSentAs(
'test2'),
'abc');
22 $visitor->after($this->command, $this->request);
23 $this->assertEquals(
'{"test":"123","test2":"abc"}', (
string) $this->request->getBody());
28 $visitor =
new Visitor();
29 $visitor->setContentTypeHeader(
'application/json-foo');
31 $visitor->visit($this->command, $this->request,
$param->setSentAs(
'test'),
'123');
32 $visitor->after($this->command, $this->request);
33 $this->assertEquals(
'application/json-foo', (
string) $this->request->getHeader(
'Content-Type'));
40 $this->assertEquals(
'{"Foo":{"test":{"baz":true,"Jenga_Yall!":"HELLO"},"bar":123}}', (
string)
$request->getBody());
46 $command->set(
'foo', array(
'not_set' =>
'abc'));
48 $result = json_decode(
$request->getBody(),
true);
49 $this->assertEquals(
'ABC', $result[
'Foo'][
'not_set']);
55 $command->set(
'arr', array(
'a',
'b'));
57 $result = json_decode(
$request->getBody(),
true);
58 $this->assertEquals(array(
'A',
'B'), $result[
'arr']);