Example #1
0
    public function testAppendXmlNamespaceWithAutoPackage()
    {
        $schema = <<<EOF
<?xml version="1.0"?>
<table name="test" namespace="\\testNs"/>
EOF;
        $doc = new DOMDocument('1.0');
        $doc->formatOutput = true;
        $config = new GeneratorConfig();
        $config->setBuildProperties(array('propel.namespace.autoPackage' => 'true'));
        $appData = new AppData();
        $appData->setGeneratorConfig($config);
        $db = new Database('testDb');
        $db->setAppData($appData);
        $table = new Table('test');
        $table->setDatabase($db);
        $table->setNamespace('\\testNs');
        $table->appendXml($doc);
        $xmlstr = trim($doc->saveXML());
        $this->assertSame($schema, $xmlstr);
        $schema = <<<EOF
<?xml version="1.0"?>
<table name="test" namespace="\\testNs" package="testPkg"/>
EOF;
        $doc = new DOMDocument('1.0');
        $doc->formatOutput = true;
        $table->setPackage('testPkg');
        $table->appendXml($doc);
        $xmlstr = trim($doc->saveXML());
        $this->assertSame($schema, $xmlstr);
    }