本文整理汇总了PHP中WebRequest::getLastStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP WebRequest::getLastStatus方法的具体用法?PHP WebRequest::getLastStatus怎么用?PHP WebRequest::getLastStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebRequest
的用法示例。
在下文中一共展示了WebRequest::getLastStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPostUploadFile
/**
* @covers ByJG\Util\WebRequest::postUploadFile
*/
public function testPostUploadFile()
{
$this->object = new WebRequest(self::SERVER_TEST);
$uploadFile = [];
$uploadFile[] = new UploadFile('field1', 'value1');
$uploadFile[] = new UploadFile('field2', 'value2', 'filename.txt');
$response = $this->object->postUploadFile($uploadFile);
$this->assertEquals(200, $this->object->getLastStatus());
$result = json_decode($response, true);
unset($result['files']['field2']['tmp_name']);
$this->assertContains('multipart/form-data; boundary=boundary-', $result['content-type']);
$this->assertEquals('POST', $result['method']);
$this->assertEquals([], $result['query_string']);
$this->assertEquals(['field1' => 'value1'], $result['post_string']);
$this->assertEquals('', $result['payload']);
$this->assertEquals(['field2' => ['name' => 'filename.txt', 'type' => '', 'error' => 0, 'size' => 6]], $result['files']);
}