public function testCreateWithParameters() { $descriptor = new InstallerDescriptor('symlink', self::SYMLINK_CLASS, null, array($param1 = new InstallerParameter('param1'), $param2 = new InstallerParameter('param2'))); $this->assertSame('symlink', $descriptor->getName()); $this->assertSame(self::SYMLINK_CLASS, $descriptor->getClassName()); $this->assertNull($descriptor->getDescription()); $this->assertSame(array('param1' => $param1, 'param2' => $param2), $descriptor->getParameters()); }
/** * Extracting an object containing the data from an installer descriptor. * * @param InstallerDescriptor $installer The installer descriptor. * * @return stdClass */ private function installerToData(InstallerDescriptor $installer) { $data = (object) array('class' => $installer->getClassName()); if ($installer->getDescription()) { $data->description = $installer->getDescription(); } if ($installer->getParameters()) { $data->parameters = $this->parametersToData($installer->getParameters()); } return $data; }