コード例 #1
0
 /**
  * Get the Platform object for this class
  *
  * @return Platform
  */
 protected function getPlatform()
 {
     static $platform;
     if (!$platform) {
         $platform = new MysqlPlatform();
         $config = new GeneratorConfig();
         $config->setBuildProperties(array('propel.mysql.tableType' => 'InnoDB'));
         $platform->setGeneratorConfig($config);
     }
     return $platform;
 }
コード例 #2
0
 public function testAddBehavior()
 {
     $platform = new MysqlPlatform();
     $config = new GeneratorConfig();
     $config->setBuildProperties(array('propel.behavior.timestampable.class' => 'propel.engine.behavior.TimestampableBehavior'));
     $platform->setGeneratorConfig($config);
     $xmlToAppData = new XmlToAppData($platform, "defaultpackage", null);
     $appData = $xmlToAppData->parseFile('fixtures/bookstore/behavior-schema.xml');
     $table = $appData->getDatabase("bookstore-behavior")->getTable('table1');
     $this->assertThat($table->getBehavior('timestampable'), $this->isInstanceOf('TimestampableBehavior'), 'addBehavior() uses the behavior class defined in build.properties');
 }
コード例 #3
0
ファイル: TableTest.php プロジェクト: nextbigsound/propel-orm
 public function testUniqueTableName()
 {
     $platform = new MysqlPlatform();
     $config = new GeneratorConfig();
     $platform->setGeneratorConfig($config);
     $xmlToAppData = new XmlToAppData($platform, 'defaultpackage', null);
     try {
         $appData = $xmlToAppData->parseFile('fixtures/unique-column/table-schema.xml');
         $this->fail('Parsing file with duplicate table name throws exception');
     } catch (EngineException $e) {
         $this->assertTrue(true, 'Parsing file with duplicate table name throws exception');
     }
 }