blink\testing\RequestActor::withFiles PHP Method

withFiles() public method

Send the request with specified files.
public withFiles ( array $files )
$files array
    public function withFiles(array $files)
    {
        foreach ($files as $key => $file) {
            if (!is_file($file)) {
                throw new InvalidParamException(sprintf("The file: '{$file}' does not exists."));
            }
            $target = new File();
            $target->name = basename($file);
            $target->size = filesize($file);
            $target->type = (new \finfo())->file($file, FILEINFO_MIME_TYPE);
            $target->tmpName = $file;
            $target->error = UPLOAD_ERR_OK;
            $this->request->files->set($key, $target);
        }
        return $this;
    }