Skip to content

Instantly share code, notes, and snippets.

@odiel
Created August 1, 2013 15:50
Show Gist options
  • Save odiel/6132633 to your computer and use it in GitHub Desktop.
Save odiel/6132633 to your computer and use it in GitHub Desktop.
public function testGetPhpBufferReturns()
{
$buffer = 'alien=Foo&ship=Variant&galaxy=Milky Way&constellation=Ursa%20Major&planet';
$request = new \Classes\Phalcon\Request();
$request->setBufferObject(new \Test\Classes\Phalcon\Request\Buffers\Mock($buffer));
$obtainedData = $request->obtainPutData();
$this->assertArrayHasKey('alien', $obtainedData);
$this->assertArrayHasKey('ship', $obtainedData);
$this->assertArrayHasKey('galaxy', $obtainedData);
$this->assertArrayHasKey('constellation', $obtainedData);
$this->assertArrayHasKey('planet', $obtainedData);
$this->assertEquals($obtainedData['alien'], 'Foo');
$this->assertEquals($obtainedData['ship'], 'Variant');
$this->assertEquals($obtainedData['galaxy'], 'Milky Way');
$this->assertEquals($obtainedData['constellation'], 'Ursa Major');
$this->assertEquals($obtainedData['planet'], '');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment