public function testMatchingPostFields() { $mock = array('method' => 'POST', 'url' => 'http://example.com', 'headers' => array(), 'post_fields' => array('field1' => 'value1', 'field2' => 'value2')); $first = Request::fromArray($mock); $second = Request::fromArray($mock); $this->assertTrue(RequestMatcher::matchPostFields($first, $second)); $mock['post_fields']['field2'] = 'changedvalue2'; $third = Request::fromArray($mock); $this->assertFalse(RequestMatcher::matchPostFields($first, $third)); }
public function testRestorePostFiles() { $this->request->addPostFile('field_name', 'tests/fixtures/unittest_curl_test'); $restoredRequest = Request::fromArray($this->request->toArray()); $this->assertEquals(array('method' => 'GET', 'url' => 'http://example.com', 'headers' => array('User-Agent' => 'Unit-Test', 'Host' => 'example.com', 'Content-Type' => 'multipart/form-data', 'Expect' => '100-Continue'), 'post_files' => array(array('fieldName' => 'field_name', 'contentType' => 'application/octet-stream', 'filename' => 'tests/fixtures/unittest_curl_test', 'postname' => 'unittest_curl_test'))), $restoredRequest->toArray()); }