/** * */ public function testDestination() { $generator = self::bingGeneratorInstance(); if (($model = $generator->getStruct('NewsArticle')) instanceof StructModel) { $generator->setOptionStructClass('\\Std\\Opt\\StructClass'); $struct = new StructFile($generator, $model->getName()); $struct->setModel($model); $this->assertSame(sprintf('%s%s%s/', self::getTestDirectory(), StructFile::SRC_FOLDER, $model->getContextualPart()), $struct->getFileDestination()); } else { $this->assertFalse(true, 'Unable to find NewsArticle struct for file generation'); } }
/** * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::setModel() * @throws \InvalidaArgumentException * @param AbstractModel $model * @return StructArray */ public function setModel(AbstractModel $model) { if ($model instanceof StructModel && !$model->getIsRestriction()) { throw new \InvalidArgumentException('Model must be a restriction containing values', __LINE__); } return parent::setModel($model); }
/** * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::setModel() * @throws \InvalidaArgumentException * @param AbstractModel $model * @return StructArray */ public function setModel(AbstractModel $model) { if ($model instanceof StructModel && !$model->isArray()) { throw new \InvalidArgumentException('The model is not a valid array struct (name must contain Array and the model must contain only one property', __LINE__); } return parent::setModel($model); }
/** * */ public function testWriteYandexDirectApiStructLiveBannerInfo() { $generator = self::yandexDirectApiLiveGeneratorInstance(true); $generator->setOptionValidation(true); if (($model = $generator->getStruct('BannerInfo')) instanceof StructModel) { $struct = new StructFile($generator, $model->getName()); $struct->setModel($model)->write(); $this->assertSameFileContent('ValidBannerInfo', $struct); } else { $this->assertFalse(true, 'Unable to find BannerInfo struct for file generation'); } }