Changeset 4347
- Timestamp:
- 05/10/08 01:03:59 (14 months ago)
- Location:
- branches/0.11
- Files:
-
- 3 modified
-
lib/Doctrine/Record/Generator.php (modified) (2 diffs)
-
tests/PluginTestCase.php (modified) (3 diffs)
-
tests/run.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/lib/Doctrine/Record/Generator.php
r4322 r4347 113 113 * @return void 114 114 */ 115 public function addChild( Doctrine_Record_Generator$generator)115 public function addChild($generator) 116 116 { 117 117 $this->_options['children'][] = $generator; … … 228 228 229 229 foreach ($this->_options['children'] as $child) { 230 $this->_table->addGenerator($child, get_class($child)); 231 232 $child->setTable($this->_table); 233 234 $child->setUp(); 230 if ($child instanceof Doctrine_Template) { 231 if ($child->getPlugin() !== null) { 232 $this->_table->addGenerator($child->getPlugin(), get_class($child->getPlugin())); 233 } 234 235 $child->setTable($this->_table); 236 $child->setTableDefinition(); 237 $child->setUp(); 238 } else { 239 $this->_table->addGenerator($child, get_class($child)); 240 $child->initialize($this->_table); 241 } 235 242 } 236 243 } -
branches/0.11/tests/PluginTestCase.php
r4029 r4347 42 42 public function testNestedPluginsGetExportedRecursively() 43 43 { 44 45 46 44 $sql = $this->conn->export->exportClassesSql(array('Wiki')); 47 45 48 $this->assertEqual($sql[0], 'CREATE TABLE wiki_translation_version ( title VARCHAR(255), content VARCHAR(2147483647), lang CHAR(2), id INTEGER, version INTEGER, PRIMARY KEY(lang, id, version))');49 $this->assertEqual($sql[1], 'CREATE TABLE wiki_translation_index ( keyword VARCHAR(200), field VARCHAR(50), position INTEGER, lang CHAR(2), id INTEGER, PRIMARY KEY(keyword, field, position, lang, id))');50 $this->assertEqual($sql[2], 'CREATE TABLE wiki_translation ( title VARCHAR(255), content VARCHAR(2147483647), lang CHAR(2), id INTEGER, version INTEGER, PRIMARY KEY(lang, id))');46 $this->assertEqual($sql[0], 'CREATE TABLE wiki_translation_version (id INTEGER, lang CHAR(2), title VARCHAR(255), content VARCHAR(2147483647), version INTEGER, PRIMARY KEY(id, lang, version))'); 47 $this->assertEqual($sql[1], 'CREATE TABLE wiki_translation_index (id INTEGER, lang CHAR(2), keyword VARCHAR(200), field VARCHAR(50), position INTEGER, PRIMARY KEY(id, lang, keyword, field, position))'); 48 $this->assertEqual($sql[2], 'CREATE TABLE wiki_translation (id INTEGER, title VARCHAR(255), content VARCHAR(2147483647), lang CHAR(2), version INTEGER, slug VARCHAR(255), PRIMARY KEY(id, lang))'); 51 49 $this->assertEqual($sql[3], 'CREATE TABLE wiki (id INTEGER PRIMARY KEY AUTOINCREMENT, created_at DATETIME, updated_at DATETIME)'); 52 50 … … 86 84 $this->assertEqual($wiki->Translation['FI']->version, 2); 87 85 } 86 87 public function testSearchableChildTemplate() 88 { 89 $this->conn->clear(); 90 91 $wiki = new Wiki(); 92 $wiki->state(Doctrine_Record::STATE_TDIRTY); 93 $wiki->save(); 94 $fi = $wiki->Translation['FI']; 95 $fi->title = 'New Title'; 96 $fi->content = "Sorry, I'm not able to write a Finish sentence about Michael Jordan..."; 97 98 $fi->save(); 99 100 $t = Doctrine::getTable('WikiTranslationIndex'); 101 $oQuery = new Doctrine_Search_Query($t); 102 $oQuery->query("jordan"); 103 $out = $this->conn->fetchAll($oQuery->getSql(), $oQuery->getParams()); 104 105 $this->assertEqual($out[0]['relevance'], 2); 106 $this->assertEqual($out[1]['relevance'], 1); 107 $this->assertEqual($out[0]['id'], 1); 108 $this->assertEqual($out[1]['id'], 2); 109 } 110 111 public function testSluggableChildTemplate() 112 { 113 $this->conn->clear(); 114 115 $wiki = new Wiki(); 116 $wiki->state(Doctrine_Record::STATE_TDIRTY); 117 $wiki->save(); 118 $fi = $wiki->Translation['FI']; 119 $fi->title = 'This is the title'; 120 $fi->content = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla sed."; 121 122 $fi->save(); 123 $this->assertEqual($fi->slug, 'this-is-the-title'); 124 } 88 125 } 89 126 … … 98 135 public function setUp() 99 136 { 100 $options = array('fields' => array('title', 'content'));137 $options = array('fields' => array('title', 'content')); 101 138 $auditLog = new Doctrine_Template_Versionable($options); 102 139 $search = new Doctrine_Template_Searchable($options); 103 $slug = new Doctrine_Template_Sluggable($options);140 $slug = new Doctrine_Template_Sluggable(array('fields' => array('title'))); 104 141 $i18n = new Doctrine_Template_I18n($options); 105 142 -
branches/0.11/tests/run.php
r4336 r4347 196 196 // Behaviors Testing 197 197 $behaviors = new GroupTest('Behaviors Tests', 'behaviors'); 198 //$behaviors->addTestCase(new Doctrine_Plugin_TestCase());198 $behaviors->addTestCase(new Doctrine_Plugin_TestCase()); 199 199 $behaviors->addTestCase(new Doctrine_View_TestCase()); 200 200 $behaviors->addTestCase(new Doctrine_AuditLog_TestCase());