summaryrefslogtreecommitdiff
path: root/vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/PostFieldVisitorTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/PostFieldVisitorTest.php')
-rw-r--r--vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/PostFieldVisitorTest.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/PostFieldVisitorTest.php b/vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/PostFieldVisitorTest.php
new file mode 100644
index 0000000..540b410
--- /dev/null
+++ b/vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/PostFieldVisitorTest.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace Guzzle\Tests\Service\Command\LocationVisitor\Request;
+
+use Guzzle\Service\Command\LocationVisitor\Request\PostFieldVisitor as Visitor;
+
+/**
+ * @covers Guzzle\Service\Command\LocationVisitor\Request\PostFieldVisitor
+ */
+class PostFieldVisitorTest extends AbstractVisitorTestCase
+{
+ public function testVisitsLocation()
+ {
+ $visitor = new Visitor();
+ $param = $this->getNestedCommand('postField')->getParam('foo');
+ $visitor->visit($this->command, $this->request, $param->setSentAs('test'), '123');
+ $this->assertEquals('123', (string) $this->request->getPostField('test'));
+ }
+
+ public function testRecursivelyBuildsPostFields()
+ {
+ $command = $this->getCommand('postField');
+ $request = $command->prepare();
+ $visitor = new Visitor();
+ $param = $command->getOperation()->getParam('foo');
+ $visitor->visit($command, $request, $param, $command['foo']);
+ $visitor->after($command, $request);
+ $this->assertEquals(
+ 'Foo[test][baz]=1&Foo[test][Jenga_Yall!]=HELLO&Foo[bar]=123',
+ rawurldecode((string) $request->getPostFields())
+ );
+ }
+}