Example #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));
 }
Example #2
0
 /**
  * Resolution error. Might later be isolated in a specific class.
  * 
  * @param string                         $element Element
  * @param PHP_UML_Metamodel_NamedElement $na      NamedElement
  */
 protected static function resolutionWarning($element, $na)
 {
     PHP_UML_Warning::add('Could not resolve ' . $element . (empty($na->file) ? '' : ' in ' . $na->file->name));
 }
Example #3
0
 /**
  * Sets the nesting package of an isolated attribute (the PHP "const")
  *
  * @param PHP_UML_Metamodel_Property &$a         A property
  * @param PHP_UML_Metamodel_Package  $nestingPkg The enclosing package
  */
 private function setNestingPackageOfAttribute(PHP_UML_Metamodel_Property &$a, PHP_UML_Metamodel_Package $nestingPkg)
 {
     $a->package = $nestingPkg;
     if (PHP_UML_Metamodel_Helper::searchAttributeIntoPackage($a->package, $a->name) === false) {
         $nestingPkg->ownedAttribute[] =& $a;
         $this->file->manifested[] =& $a;
     } else {
         PHP_UML_Warning::add('Constant ' . $a->name . ' already defined, in ' . $this->file->name);
     }
 }
Example #4
0
 /**
  * Clears the pile
  */
 public static function clear()
 {
     self::$stack = array();
 }
Example #5
0
 /**
  * Makes the type resolution for a given element in a given package
  *
  * @param PHP_UML_Metamodel_Package &$pkg     The nesting package
  * @param string                    &$element The element to resolve, provided as a name
  * @param PHP_UML_Metamodel_Package &$_pkgDef The root package
  * @param PHP_UML_Metamodel_Type    &$context The context (the nesting class/interface, which 
  *                                            is the only element to know the nesting file)
  */
 private function _resolveType(PHP_UML_Metamodel_Package &$pkg, &$element, PHP_UML_Metamodel_Package &$_pkgDef, PHP_UML_Metamodel_Type &$context)
 {
     $_o = $this->_searchIntoPackage($pkg, $element);
     if (!($_o === false)) {
         $element = $_o;
     } else {
         $_o = $this->_searchIntoPackage($_pkgDef, $element);
         if (!($_o === false)) {
             $element = $_o;
         } else {
             $_o = $this->_searchIntoDatatype($element);
             if (!($_o === false)) {
                 $element = $_o;
             } else {
                 PHP_UML_Warning::add('Could not resolve ' . $element . ' in ' . $context->file->name);
                 $element = null;
             }
         }
     }
 }