Development

Changeset 2874

You must first sign up to be able to contribute.

Changeset 2874

Show
Ignore:
Timestamp:
11/29/06 17:48:01 (2 years ago)
Author:
chtito
Message:

some new tests for propel import

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfDoctrinePlugin/addon/sfDoctrineDatabaseSchema.class.php

    r2850 r2874  
    744744  protected $tables = array(); 
    745745   
     746  public function getClasses() 
     747  { 
     748    return $this->classes; 
     749  } 
     750 
    746751  protected function getClass($className) 
    747752  { 
     
    844849class sfDoctrineSchemaDoctrineLoader extends sfDoctrineDatabaseSchema 
    845850{ 
    846   public function getClasses() 
    847   { 
    848     return $this->classes; 
    849   } 
    850  
    851851  // recursively finds out what a class table is 
    852852  // FIXME: check for infinite loop? 
  • plugins/sfDoctrinePlugin/test/prove.php

    r2690 r2874  
    2828// unit tests 
    2929$h->register_glob($h->base_dir.'/unit/*/*Test.php'); 
    30 #$h->register_glob($h->base_dir.'/unit/*/sfDoctrineSchemaDoctrineLoaderTest.php'); 
    3130 
    3231// functional tests 
  • plugins/sfDoctrinePlugin/test/unit/addon/fixtures/propelTestSchema.xml

    r2690 r2874  
    55    <column name="description" type="longvarchar" /> 
    66    <column name="id" type="integer" primaryKey="true" autoIncrement="true" /> 
     7    <foreign-key foreignTable="dummy"> 
     8      <reference foreign="id" local="dummy_id"/> 
     9    </foreign-key> 
    710  </table> 
     11  <table name="dummy" phpName="DummyPHP"> 
     12   <column name="foo" type="integer"/> 
     13  </table> 
    814</database> 
  • plugins/sfDoctrinePlugin/test/unit/addon/fixtures/propelTestSchema.yml

    r2690 r2874  
    1919      required: true 
    2020      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  
    1818require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1919 
    20 $t = new lime_test(6,new lime_output_color()); 
     20$t = new lime_test(12, new lime_output_color()); 
    2121 
    2222class sfDoctrineSchemaPropelLoaderTestProxy extends sfDoctrineSchemaPropelLoader { 
     
    4949    $this->t->diag('->getTables()'); 
    5050    $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."); 
    5353     
    5454    $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'); 
    5759 
    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'."); 
    6060     
    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."); 
    6464     
    6565    $this->t->diag('->findClassByTableName()'); 
     
    6969 
    7070//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 
    7175$schemaFixture = dirname(__FILE__)."/fixtures/propelTestSchema.yml"; 
    7276$schema = new sfDoctrineSchemaPropelLoaderTestProxy($t);