protected function assertEmptyBuilderOutput($schema) { $builder = new PropelQuickBuilder(); $builder->setSchema($schema); ob_start(); $builder->buildClasses(); $output = preg_replace('/[\\r\\n]/', '', ob_get_contents()); ob_end_clean(); $this->assertEquals('', $output); }
public function setUp() { if (!class_exists('Foo\\MyClassWithInterface')) { $schema = <<<EOF <database name="a-database" namespace="Foo"> \t<table name="my_class_with_interface" interface="MyInterface"> \t\t<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" /> \t\t<column name="name" type="VARCHAR" /> \t</table> </database> EOF; $builder = new PropelQuickBuilder(); $builder->setSchema($schema); $builder->buildClasses(); } }
/** * @expectedException PropelException */ public function testDoInsert() { if (!class_exists('Unexistent')) { $schema = <<<EOF <database name="a-database"> <table name="unexistent"> <column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" /> <column name="name" type="VARCHAR" /> </table> </database> EOF; $builder = new PropelQuickBuilder(); $builder->setSchema($schema); $builder->buildClasses(); } $object = new Unexistent(); $object->setName('Foo'); $object->save(); $this->fail('Should not be called'); }
<?php /* * This file is part of the FOSUserBundle package. * * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ if (!is_file($autoloadFile = __DIR__ . '/../vendor/autoload.php')) { throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?'); } require $autoloadFile; if (class_exists('Propel')) { set_include_path(__DIR__ . '/../vendor/phing/phing/classes' . PATH_SEPARATOR . get_include_path()); $class = new \ReflectionClass('TypehintableBehavior'); $builder = new \PropelQuickBuilder(); $builder->getConfig()->setBuildProperty('behavior.typehintable.class', $class->getFileName()); $builder->setSchema(file_get_contents(__DIR__ . '/../Resources/config/propel/schema.xml')); $builder->buildClasses(); }