本文整理汇总了PHP中FileUpload::processAll方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUpload::processAll方法的具体用法?PHP FileUpload::processAll怎么用?PHP FileUpload::processAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUpload
的用法示例。
在下文中一共展示了FileUpload::processAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSingleUpload
public function testSingleUpload()
{
$playground_path = __DIR__ . '/../playground';
$server = array('CONTENT_TYPE' => 'image/jpg', 'CONTENT_LENGTH' => 30321);
$file = array('tmp_name' => $playground_path . '/real-image.jpg', 'name' => 'real-image.jpg', 'size' => 30321, 'type' => 'image/jpg', 'error' => 0);
$filesystem = new FileSystem\Mock();
$resolver = new PathResolver\Simple($playground_path . '/uploaded');
$uploader = new FileUpload($file, $server);
$test = false;
$uploader->setPathResolver($resolver);
$uploader->setFileSystem($filesystem);
$uploader->addCallback('completed', function () use(&$test) {
$test = true;
});
list($files, $headers) = $uploader->processAll();
$this->assertCount(1, $files, 'Files array should contain one file');
$this->assertEquals(0, $files[0]->error, 'Uploaded file should not have errors');
$this->assertNotEmpty($files[0]->path, 'Uploaded file should have path');
$this->assertTrue($test, 'Complete callback should set $test to true');
}