Changeset 2874
- Timestamp:
- 11/29/06 17:48:01 (2 years ago)
- Files:
-
- plugins/sfDoctrinePlugin/addon/sfDoctrineDatabaseSchema.class.php (modified) (2 diffs)
- plugins/sfDoctrinePlugin/test/prove.php (modified) (1 diff)
- plugins/sfDoctrinePlugin/test/unit/addon/fixtures/propelTestSchema.xml (modified) (1 diff)
- plugins/sfDoctrinePlugin/test/unit/addon/fixtures/propelTestSchema.yml (modified) (1 diff)
- plugins/sfDoctrinePlugin/test/unit/addon/sfDoctrineSchemaPropelLoaderTest.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfDoctrinePlugin/addon/sfDoctrineDatabaseSchema.class.php
r2850 r2874 744 744 protected $tables = array(); 745 745 746 public function getClasses() 747 { 748 return $this->classes; 749 } 750 746 751 protected function getClass($className) 747 752 { … … 844 849 class sfDoctrineSchemaDoctrineLoader extends sfDoctrineDatabaseSchema 845 850 { 846 public function getClasses()847 {848 return $this->classes;849 }850 851 851 // recursively finds out what a class table is 852 852 // FIXME: check for infinite loop? plugins/sfDoctrinePlugin/test/prove.php
r2690 r2874 28 28 // unit tests 29 29 $h->register_glob($h->base_dir.'/unit/*/*Test.php'); 30 #$h->register_glob($h->base_dir.'/unit/*/sfDoctrineSchemaDoctrineLoaderTest.php');31 30 32 31 // functional tests plugins/sfDoctrinePlugin/test/unit/addon/fixtures/propelTestSchema.xml
r2690 r2874 5 5 <column name="description" type="longvarchar" /> 6 6 <column name="id" type="integer" primaryKey="true" autoIncrement="true" /> 7 <foreign-key foreignTable="dummy"> 8 <reference foreign="id" local="dummy_id"/> 9 </foreign-key> 7 10 </table> 11 <table name="dummy" phpName="DummyPHP"> 12 <column name="foo" type="integer"/> 13 </table> 8 14 </database> plugins/sfDoctrinePlugin/test/unit/addon/fixtures/propelTestSchema.yml
r2690 r2874 19 19 required: true 20 20 default: 21 dummy_id: 22 foreignTable: dummy 23 dummy: 24 _attributes: {phpName: DummyPHP} 25 foo: integer(10) plugins/sfDoctrinePlugin/test/unit/addon/sfDoctrineSchemaPropelLoaderTest.php
r2690 r2874 18 18 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 19 19 20 $t = new lime_test( 6,new lime_output_color());20 $t = new lime_test(12, new lime_output_color()); 21 21 22 22 class sfDoctrineSchemaPropelLoaderTestProxy extends sfDoctrineSchemaPropelLoader { … … 49 49 $this->t->diag('->getTables()'); 50 50 $tables = $this->getTables(); 51 $this->t->is(count($tables), 1,"->getTables() should return 1 table from fixture.");52 $this->t-> cmp_ok(array_pop(array_keys($tables)),'===','testTable',"->getTables() should return 'testTable' from fixture.");51 $this->t->is(count($tables),2,"->getTables() should return 1 table from fixture."); 52 $this->t->ok(in_array('testTable', array_keys($tables)), "->getTables() should return 'testTable' from fixture."); 53 53 54 54 $this->t->diag('->classes'); 55 $this->t->is(count($this->classes),1,"->classes should have 1 class from fixture"); 56 $this->t->cmp_ok(array_pop(array_keys($this->classes)),'===','TestTable',"->classes should have 'TestTable' from fixture."); 55 $this->t->is(count($this->classes),2,"->classes should have 1 class from fixture"); 56 $this->t->ok($this->getClass('TestTable'),"->classes should have 'TestTable' from fixture."); 57 58 $this->t->ok($this->getClass('TestTable')->getColumn('dummy_id')->hasRelation(), 'foreign relation is properly imported'); 57 59 58 $this->t->diag('->getAttribute()');59 #$this->t->is($this->getAttribute(array_pop(array_keys($tables)),'idMethod'), 'native',"->getAttribute() should return for idMethod attribute value 'native'.");60 60 61 $this->t->diag('->asDoctrineYml()');62 $yml = $this->asDoctrineYml();63 $this->t->cmp_ok(strlen($yml['source']), '>', 0, "->asDoctrineYml() doctrine YAML shoudl not be empty.");61 #$this->t->diag('->asDoctrineYml()'); 62 #$yml = $this->asDoctrineYml(); 63 #$this->t->cmp_ok(strlen($yml['source']), '>', 0, "->asDoctrineYml() doctrine YAML shoudl not be empty."); 64 64 65 65 $this->t->diag('->findClassByTableName()'); … … 69 69 70 70 //Load Propel schema from fixtures and run tests 71 $schemaFixture = dirname(__FILE__)."/fixtures/propelTestSchema.xml"; 72 $schema = new sfDoctrineSchemaPropelLoaderTestProxy($t); 73 $schema->launchTests($schemaFixture); 74 71 75 $schemaFixture = dirname(__FILE__)."/fixtures/propelTestSchema.yml"; 72 76 $schema = new sfDoctrineSchemaPropelLoaderTestProxy($t);