示例#1
0
//set $token = getenv('KBC_TOKEN');
if (count($argv) < 2) {
    print 'php-uploader error: kbc token not provided';
    exit(1);
}
$token = $argv[1];
if (empty($token)) {
    print 'php-uploader error: kbc token not provided or missing';
    exit(1);
}
//set $filesPath
if (count($argv) < 3) {
    print 'php-uploader error: upload path not provided';
    exit(1);
}
$filesPath = $argv[2];
// set run id
$runId = '';
if (count($argv) > 3) {
    $runId = $argv[3];
}
$sapiClient = new Client(['token' => $token]);
$sapiClient->setRunId($runId);
$uploader = new Uploader($sapiClient);
try {
    $uploader->uploadFiles($filesPath);
} catch (\Exception $e) {
    print $e->getMessage();
    exit(1);
}
exit(0);
示例#2
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Found orphaned file manifest: 'file1.manifest'
  */
 public function testWriteFilesOrphanedManifest()
 {
     $root = $this->tmp->getTmpFolder();
     file_put_contents($root . "/upload/file1.manifest", "tags: [\"tde-exporter-php-test-xxx\"]\nis_public: true");
     $writer = new Uploader($this->client);
     $writer->uploadFiles($root . "/upload");
 }