Ejemplo n.º 1
0
 /**
  * Tests the various calls to the API made from scripts/phpuml
  * 
  */
 public function testPhpUmlScript()
 {
     $output = self::TEMP_DIR . 'new_phpumlscript.xmi';
     $version = 1;
     $modelName = 'Foo';
     $encoding = 'iso-8859-1';
     $errorLevel = 1;
     $uml = new PHP_UML();
     $uml->setInput(self::SUITE_DIR . 'test1.php');
     $uml->deploymentView = true;
     $uml->componentView = true;
     $uml->dollar = true;
     $uml->docblocks = true;
     $uml->onlyApi = false;
     $uml->showInternal = true;
     $uml->pureObject = false;
     $uml->setMatchPatterns('*.php');
     $uml->setIgnorePatterns('.svn');
     PHP_UML_Warning::clear();
     $uml->parse('test');
     $e = PHP_UML_Output_Exporter::getInstance('xmi');
     $uml->setExporter($e);
     if ($e instanceof PHP_UML_Output_Xmi_Exporter) {
         $e->setEncoding($encoding);
         $e->setXmiVersion($version);
     }
     if ($e instanceof PHP_UML_Output_Xmi_Exporter) {
         $e->generateXmi();
         echo $e->getXmiDocument()->dump();
     }
     $e->export($output);
     foreach (PHP_UML_Warning::$stack as $msg) {
         echo $msg . "\n";
     }
     $this->assertTrue(file_exists($output));
 }
Ejemplo n.º 2
0
 /**
  * Convert the UML model (stored in the object) into some output data.
  * 
  * @param string $format    Desired format ("xmi", "html", "php"...)
  * @param string $outputDir Output directory
  */
 public function export($format = 'xmi', $outputDir = '.')
 {
     if (empty($outputDir)) {
         throw new PHP_UML_Exception('No output folder given.');
     }
     if (empty($this->model) || empty($this->model->packages)) {
         throw new PHP_UML_Exception('No model given.');
     }
     $this->exporter = PHP_UML_Output_Exporter::getInstance($format);
     $this->exporter->setModel($this->model);
     return $this->exporter->export($outputDir);
 }