public function testElementsComeOutInTheRightNamespace() { $location_of_sca_class = SCA_Helper::getFileContainingClass("SCA"); $sca_dir = dirname($location_of_sca_class); $location_of_atom_xsd = $sca_dir . "/Bindings/atom/Atom1.0.xsd"; $xmldas = SDO_DAS_XML::create($location_of_atom_xsd); $document = $xmldas->createDocument('http://www.w3.org/2005/Atom', 'entry'); $entry = $document->getRootDataObject(); $author = $entry->createDataObject('author'); $author->name[] = "Caroline Maynard"; $xml = $xmldas->saveString($document, 2); $this->assertContains("<tns:author>", $xml); $this->assertContains("<tns:name>", $xml); }
/** * Construct Absolute Path * * @param string $relative_path Relative path * @param string $class_name Class name * * @return string */ public static function constructAbsolutePath($relative_path, $class_name) { $file_containing_class = SCA_Helper::getFileContainingClass($class_name); $dir = dirname($file_containing_class); $absolute_path = realpath("{$dir}/{$relative_path}"); if ($absolute_path === null || strlen($absolute_path) == 0) { throw new SCA_RuntimeException("Only an invalid absolute path could be constructed from class {$class_name} and relative path {$relative_path}"); } return $absolute_path; }
/** * This function can be called directly by a php script to dispatch a request to * an SCA service. You only need to use this operation when you organize your * code so that the service implementation (and SCA/SCA.php include) are included * by in a script that is just a wrapper script and is not acting as a client for * the service. This can happen if you want keep php files that define service * outside of the htdocs directory * * @param string $class_name The class_name that implements the target service * * @return void */ public static function dispatch($class_name) { $file_name = SCA_Helper::getFileContainingClass($class_name); $_SERVER['SCRIPT_FILENAME'] = $file_name; SCA::initComponent($file_name); }