public function testCreateLicense() { $this->initContext(); $file_license = file_get_contents(dirname(__FILE__) . "/../data/license_Example.json"); $data = json_decode($file_license, true); $license = new RestoLicense($this->context, $data['licenseId'], false); $license->setDescription($data); }
/** * * Process HTTP POST request on licenses * * licenses * * @param array $segments * @param array $data */ private function POST_licenses($segments, $data) { /* * No modifier allowed */ if (isset($segments[1])) { RestoLogUtil::httpError(404); } if (!isset($data['licenseId'])) { RestoLogUtil::httpError(400, 'license Identifier is not set'); } $license = new RestoLicense($this->context, $data['licenseId'], false); $license->setDescription($data); return RestoLogUtil::success('license ' . $data['licenseId'] . ' created'); }