public function setUp() { // run only once to save execution time if (null == self::$database) { $xmlToAppData = new XmlToAppData(new DefaultPlatform()); $appData = $xmlToAppData->parseFile(realpath(__DIR__ . '/../../../../../Fixtures/bookstore/schema.xml')); self::$database = $appData->getDatabase("bookstore"); } }
public function testParseFileExternalSchema() { $path = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'outerSchema.xml'); $xtad = new XmlToAppData(); $appData = $xtad->parseFile($path); $expectedAppData = <<<EOF <app-data> <database name="foo" defaultIdMethod="native" defaultPhpNamingMethod="underscore" defaultTranslateMethod="none"> <table name="bar1" phpName="Bar1" idMethod="false" readOnly="false" reloadOnInsert="false" reloadOnUpdate="false" abstract="false"> <column name="id" phpName="Id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/> </table> <table name="bar2" phpName="Bar2" idMethod="false" readOnly="false" reloadOnInsert="false" reloadOnUpdate="false" forReferenceOnly="true" abstract="false"> <column name="id" phpName="Id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/> </table> </database> </app-data> EOF; $this->assertEquals($expectedAppData, $appData->toString()); }