/** * Upload the local template to Livedocx service and return a new instance of corresponding * remote template * * @return Remote * * @throws FileExistException * @throws UploadException */ public function upload() { try { $templatecontent = $this->getBase64Contents(); $filename = basename($this->getName()); } catch (FileExistException $ex) { throw new FileExistException('Template file does not exist or is not readable', $ex); } try { $this->getSoapClient()->UploadTemplate(['template' => $templatecontent, 'filename' => $filename]); $remoteTemplate = new Remote($this->getSoapClient()); $remoteTemplate->setName($this->getName()); return $remoteTemplate; } catch (SoapException $ex) { throw new UploadException('Error while uploading the template', $ex); } }
public function test_getFieldNames_return_array_with_a_string() { $mock = $this->scaffoldMock(); $mock->getMockController()->SetRemoteTemplate = true; $mock->getMockController()->TemplateExists = function () { $ret = new stdClass(); $ret->TemplateExistsResult = true; return $ret; }; $mock->getMockController()->GetFieldNames = function () { $ret = new \stdClass(); $ret->GetFieldNamesResult = new \stdClass(); $ret->GetFieldNamesResult->string = 'value'; return $ret; }; $remote = new LdxRemote($mock); $remote->setName('test-remote-4.dat'); $remote->setAsActive(); $this->array($remote->getFieldNames())->containsValues(['value']); }