Changeset 1082 for trunk/generator/test/classes/propel
- Timestamp:
- 09/17/08 14:11:31 (3 months ago)
- Files:
-
- trunk (modified) (1 prop)
- trunk/generator/test/classes/propel/CharacterEncodingTest.php (modified) (6 diffs)
- trunk/generator/test/classes/propel/FieldnameRelatedTest.php (modified) (26 diffs)
- trunk/generator/test/classes/propel/GeneratedNestedSetObjectTest.php (modified) (11 diffs)
- trunk/generator/test/classes/propel/GeneratedNestedSetPeerTest.php (modified) (15 diffs)
- trunk/generator/test/classes/propel/GeneratedNestedSetTest.php (modified) (5 diffs)
- trunk/generator/test/classes/propel/GeneratedObjectLobTest.php (modified) (6 diffs)
- trunk/generator/test/classes/propel/GeneratedObjectRelTest.php (modified) (16 diffs)
- trunk/generator/test/classes/propel/GeneratedObjectTest.php (modified) (53 diffs)
- trunk/generator/test/classes/propel/GeneratedPeerTest.php (modified) (52 diffs)
- trunk/generator/test/classes/propel/Ticket520Test.php (modified) (11 diffs)
- trunk/generator/test/classes/propel/util/BasePeerTest.php (modified) (5 diffs)
- trunk/generator/test/classes/propel/util/PropelPDOTest.php (modified) (3 diffs)
- trunk/generator/test/classes/propel/validator/ValidatorTest.php (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk
- Property svn:ignore set to
.project
.cache
.settings
- Property svn:ignore set to
trunk/generator/test/classes/propel/CharacterEncodingTest.php
r1068 r1082 1 1 <?php 2 3 use bookstore::Peer as PropelPeer; 4 use bookstore::Model as PropelModel; 5 2 6 /* 3 7 * $Id: GeneratedPeerTest.php 842 2007-12-02 16:28:20Z heltem $ … … 54 58 public function testUtf8() 55 59 { 56 $db = Propel::getDB(BookPeer::DATABASE_NAME);60 $db = ::Propel::getDB(PropelPeer::BookPeer::DATABASE_NAME); 57 61 58 62 $title = "СЌеÑÑÑ ÐœÐ° бÑÑЎеÑÑаÑÑ. ÐÐ»Ð°ÐŽÐµÐœÐµÑ Ðž ÑеÑÑ"; … … 60 64 // 1 2 3 61 65 62 $a = new Author();66 $a = new PropelModel::Author(); 63 67 $a->setFirstName("Ð."); 64 68 $a->setLastName("ÐÐУÐÐÐ"); 65 69 66 $p = new P ublisher();70 $p = new PropelModel::Publisher(); 67 71 $p->setName("ÐеÑекÑОв ÑПÑÑОйÑкОй, ПÑÑÑПÑÑжеÑÐœÐ°Ñ Ð¿ÑПза"); 68 72 69 $b = new Book();73 $b = new PropelModel::Book(); 70 74 $b->setTitle($title); 71 75 $b->setISBN("B-59246"); … … 83 87 public function testInvalidCharset() 84 88 { 85 $db = Propel::getDB(BookPeer::DATABASE_NAME);89 $db = ::Propel::getDB(PropelPeer::BookPeer::DATABASE_NAME); 86 90 if ($db instanceof DBSQLite) { 87 91 $this->markTestSkipped(); 88 92 } 89 93 90 $a = new Author();94 $a = new PropelModel::Author(); 91 95 $a->setFirstName("Ð."); 92 96 $a->setLastName("ÐÐУÐÐÐ"); … … 110 114 $a->save(); 111 115 $a->reload(); 112 116 print_r($a); 113 117 $this->assertEquals("",$a->getLastName(), "Expected last_name to be empty (after inserting invalid charset data)"); 114 118 } … … 117 121 118 122 } 123 124 ?> trunk/generator/test/classes/propel/FieldnameRelatedTest.php
r1024 r1082 1 1 <?php 2 3 use bookstore::Peer as PropelPeer; 4 use bookstore::Model as PropelModel; 5 2 6 /* 3 7 * $Id$ … … 28 32 * - Base[Object]Peer::getFieldNames() 29 33 * - Base[Object]Peer::translateFieldName() 30 * - BasePeer::getFieldNames()31 * - BasePeer::translateFieldName()34 * - ::BasePeer::getFieldNames() 35 * - ::BasePeer::translateFieldName() 32 36 * - Base[Object]::getByName() 33 37 * - Base[Object]::setByName() … … 48 52 public function testFieldNameTypeConstants () { 49 53 50 $result = defined(' BasePeer::TYPE_PHPNAME');54 $result = defined('::BasePeer::TYPE_PHPNAME'); 51 55 $this->assertTrue($result); 52 56 } … … 58 62 59 63 $types = array( 60 BasePeer::TYPE_PHPNAME,61 BasePeer::TYPE_COLNAME,62 BasePeer::TYPE_FIELDNAME,63 BasePeer::TYPE_NUM64 ); 65 $expecteds = array ( 66 BasePeer::TYPE_PHPNAME => array(64 ::BasePeer::TYPE_PHPNAME, 65 ::BasePeer::TYPE_COLNAME, 66 ::BasePeer::TYPE_FIELDNAME, 67 ::BasePeer::TYPE_NUM 68 ); 69 $expecteds = array ( 70 ::BasePeer::TYPE_PHPNAME => array( 67 71 0 => 'Id', 68 72 1 => 'Title', … … 72 76 5 => 'AuthorId' 73 77 ), 74 BasePeer::TYPE_STUDLYPHPNAME => array(78 ::BasePeer::TYPE_STUDLYPHPNAME => array( 75 79 0 => 'id', 76 80 1 => 'title', … … 80 84 5 => 'authorId' 81 85 ), 82 BasePeer::TYPE_COLNAME => array(86 ::BasePeer::TYPE_COLNAME => array( 83 87 0 => 'book.ID', 84 88 1 => 'book.TITLE', … … 88 92 5 => 'book.AUTHOR_ID' 89 93 ), 90 BasePeer::TYPE_FIELDNAME => array(94 ::BasePeer::TYPE_FIELDNAME => array( 91 95 0 => 'id', 92 96 1 => 'title', … … 96 100 5 => 'author_id' 97 101 ), 98 BasePeer::TYPE_NUM => array(102 ::BasePeer::TYPE_NUM => array( 99 103 0 => 0, 100 104 1 => 1, … … 107 111 108 112 foreach ($types as $type) { 109 $results[$type] = BookPeer::getFieldnames($type);113 $results[$type] = PropelPeer::BookPeer::getFieldnames($type); 110 114 $this->assertEquals( 111 115 $expecteds[$type], … … 123 127 124 128 $types = array( 125 BasePeer::TYPE_PHPNAME,126 BasePeer::TYPE_STUDLYPHPNAME,127 BasePeer::TYPE_COLNAME,128 BasePeer::TYPE_FIELDNAME,129 BasePeer::TYPE_NUM130 ); 131 $expecteds = array ( 132 BasePeer::TYPE_PHPNAME => 'AuthorId',133 BasePeer::TYPE_STUDLYPHPNAME => 'authorId',134 BasePeer::TYPE_COLNAME => 'book.AUTHOR_ID',135 BasePeer::TYPE_FIELDNAME => 'author_id',136 BasePeer::TYPE_NUM => 5,129 ::BasePeer::TYPE_PHPNAME, 130 ::BasePeer::TYPE_STUDLYPHPNAME, 131 ::BasePeer::TYPE_COLNAME, 132 ::BasePeer::TYPE_FIELDNAME, 133 ::BasePeer::TYPE_NUM 134 ); 135 $expecteds = array ( 136 ::BasePeer::TYPE_PHPNAME => 'AuthorId', 137 ::BasePeer::TYPE_STUDLYPHPNAME => 'authorId', 138 ::BasePeer::TYPE_COLNAME => 'book.AUTHOR_ID', 139 ::BasePeer::TYPE_FIELDNAME => 'author_id', 140 ::BasePeer::TYPE_NUM => 5, 137 141 ); 138 142 foreach ($types as $fromType) { … … 140 144 $name = $expecteds[$fromType]; 141 145 $expected = $expecteds[$toType]; 142 $result = BookPeer::translateFieldName($name, $fromType, $toType);146 $result = PropelPeer::BookPeer::translateFieldName($name, $fromType, $toType); 143 147 $this->assertEquals($expected, $result); 144 148 } … … 147 151 148 152 /** 149 * Tests the BasePeer::getFieldNames() method153 * Tests the ::BasePeer::getFieldNames() method 150 154 */ 151 155 public function testGetFieldNamesStatic () { 152 156 153 157 $types = array( 154 BasePeer::TYPE_PHPNAME,155 BasePeer::TYPE_STUDLYPHPNAME,156 BasePeer::TYPE_COLNAME,157 BasePeer::TYPE_FIELDNAME,158 BasePeer::TYPE_NUM159 ); 160 $expecteds = array ( 161 BasePeer::TYPE_PHPNAME => array(158 ::BasePeer::TYPE_PHPNAME, 159 ::BasePeer::TYPE_STUDLYPHPNAME, 160 ::BasePeer::TYPE_COLNAME, 161 ::BasePeer::TYPE_FIELDNAME, 162 ::BasePeer::TYPE_NUM 163 ); 164 $expecteds = array ( 165 ::BasePeer::TYPE_PHPNAME => array( 162 166 0 => 'Id', 163 167 1 => 'Title', … … 167 171 5 => 'AuthorId' 168 172 ), 169 BasePeer::TYPE_STUDLYPHPNAME => array(173 ::BasePeer::TYPE_STUDLYPHPNAME => array( 170 174 0 => 'id', 171 175 1 => 'title', … … 175 179 5 => 'authorId' 176 180 ), 177 BasePeer::TYPE_COLNAME => array(181 ::BasePeer::TYPE_COLNAME => array( 178 182 0 => 'book.ID', 179 183 1 => 'book.TITLE', … … 183 187 5 => 'book.AUTHOR_ID' 184 188 ), 185 BasePeer::TYPE_FIELDNAME => array(189 ::BasePeer::TYPE_FIELDNAME => array( 186 190 0 => 'id', 187 191 1 => 'title', … … 191 195 5 => 'author_id' 192 196 ), 193 BasePeer::TYPE_NUM => array(197 ::BasePeer::TYPE_NUM => array( 194 198 0 => 0, 195 199 1 => 1, … … 202 206 203 207 foreach ($types as $type) { 204 $results[$type] = BasePeer::getFieldnames('Book', $type);208 $results[$type] = ::BasePeer::getFieldnames('Book', $type); 205 209 $this->assertEquals( 206 210 $expecteds[$type], … … 213 217 214 218 /** 215 * Tests the BasePeer::translateFieldName() method219 * Tests the ::BasePeer::translateFieldName() method 216 220 */ 217 221 public function testTranslateFieldNameStatic () { 218 222 219 223 $types = array( 220 BasePeer::TYPE_PHPNAME,221 BasePeer::TYPE_STUDLYPHPNAME,222 BasePeer::TYPE_COLNAME,223 BasePeer::TYPE_FIELDNAME,224 BasePeer::TYPE_NUM225 ); 226 $expecteds = array ( 227 BasePeer::TYPE_PHPNAME => 'AuthorId',228 BasePeer::TYPE_STUDLYPHPNAME => 'authorId',229 BasePeer::TYPE_COLNAME => 'book.AUTHOR_ID',230 BasePeer::TYPE_FIELDNAME => 'author_id',231 BasePeer::TYPE_NUM => 5,224 ::BasePeer::TYPE_PHPNAME, 225 ::BasePeer::TYPE_STUDLYPHPNAME, 226 ::BasePeer::TYPE_COLNAME, 227 ::BasePeer::TYPE_FIELDNAME, 228 ::BasePeer::TYPE_NUM 229 ); 230 $expecteds = array ( 231 ::BasePeer::TYPE_PHPNAME => 'AuthorId', 232 ::BasePeer::TYPE_STUDLYPHPNAME => 'authorId', 233 ::BasePeer::TYPE_COLNAME => 'book.AUTHOR_ID', 234 ::BasePeer::TYPE_FIELDNAME => 'author_id', 235 ::BasePeer::TYPE_NUM => 5, 232 236 ); 233 237 foreach ($types as $fromType) { … … 235 239 $name = $expecteds[$fromType]; 236 240 $expected = $expecteds[$toType]; 237 $result = BasePeer::translateFieldName('Book', $name, $fromType, $toType);241 $result = ::BasePeer::translateFieldName('Book', $name, $fromType, $toType); 238 242 $this->assertEquals($expected, $result); 239 243 } … … 247 251 248 252 $types = array( 249 BasePeer::TYPE_PHPNAME => 'Title',250 BasePeer::TYPE_STUDLYPHPNAME => 'title',251 BasePeer::TYPE_COLNAME => 'book.TITLE',252 BasePeer::TYPE_FIELDNAME => 'title',253 BasePeer::TYPE_NUM => 1254 ); 255 256 $book = new Book();253 ::BasePeer::TYPE_PHPNAME => 'Title', 254 ::BasePeer::TYPE_STUDLYPHPNAME => 'title', 255 ::BasePeer::TYPE_COLNAME => 'book.TITLE', 256 ::BasePeer::TYPE_FIELDNAME => 'title', 257 ::BasePeer::TYPE_NUM => 1 258 ); 259 260 $book = new PropelModel::Book(); 257 261 $book->setTitle('Harry Potter and the Order of the Phoenix'); 258 262 … … 269 273 public function testSetByName() { 270 274 271 $book = new Book();272 $types = array( 273 BasePeer::TYPE_PHPNAME => 'Title',274 BasePeer::TYPE_STUDLYPHPNAME => 'title',275 BasePeer::TYPE_COLNAME => 'book.TITLE',276 BasePeer::TYPE_FIELDNAME => 'title',277 BasePeer::TYPE_NUM => 1275 $book = new PropelModel::Book(); 276 $types = array( 277 ::BasePeer::TYPE_PHPNAME => 'Title', 278 ::BasePeer::TYPE_STUDLYPHPNAME => 'title', 279 ::BasePeer::TYPE_COLNAME => 'book.TITLE', 280 ::BasePeer::TYPE_FIELDNAME => 'title', 281 ::BasePeer::TYPE_NUM => 1 278 282 ); 279 283 … … 294 298 295 299 $types = array( 296 BasePeer::TYPE_PHPNAME,297 BasePeer::TYPE_STUDLYPHPNAME,298 BasePeer::TYPE_COLNAME,299 BasePeer::TYPE_FIELDNAME,300 BasePeer::TYPE_NUM301 ); 302 $expecteds = array ( 303 BasePeer::TYPE_PHPNAME => array (300 ::BasePeer::TYPE_PHPNAME, 301 ::BasePeer::TYPE_STUDLYPHPNAME, 302 ::BasePeer::TYPE_COLNAME, 303 ::BasePeer::TYPE_FIELDNAME, 304 ::BasePeer::TYPE_NUM 305 ); 306 $expecteds = array ( 307 ::BasePeer::TYPE_PHPNAME => array ( 304 308 'Title' => 'Harry Potter and the Order of the Phoenix', 305 309 'ISBN' => '043935806X' 306 310 ), 307 BasePeer::TYPE_STUDLYPHPNAME => array (311 ::BasePeer::TYPE_STUDLYPHPNAME => array ( 308 312 'title' => 'Harry Potter and the Order of the Phoenix', 309 313 'iSBN' => '043935806X' 310 314 ), 311 BasePeer::TYPE_COLNAME => array (315 ::BasePeer::TYPE_COLNAME => array ( 312 316 'book.TITLE' => 'Harry Potter and the Order of the Phoenix', 313 317 'book.ISBN' => '043935806X' 314 318 ), 315 BasePeer::TYPE_FIELDNAME => array (319 ::BasePeer::TYPE_FIELDNAME => array ( 316 320 'title' => 'Harry Potter and the Order of the Phoenix', 317 321 'isbn' => '043935806X' 318 322 ), 319 BasePeer::TYPE_NUM => array (323 ::BasePeer::TYPE_NUM => array ( 320 324 '1' => 'Harry Potter and the Order of the Phoenix', 321 325 '2' => '043935806X' … … 323 327 ); 324 328 325 $book = new Book();329 $book = new PropelModel::Book(); 326 330 327 331 foreach ($types as $type) { … … 347 351 348 352 $types = array( 349 BasePeer::TYPE_PHPNAME,350 BasePeer::TYPE_STUDLYPHPNAME,351 BasePeer::TYPE_COLNAME,352 BasePeer::TYPE_FIELDNAME,353 BasePeer::TYPE_NUM354 ); 355 356 $book = new Book();353 ::BasePeer::TYPE_PHPNAME, 354 ::BasePeer::TYPE_STUDLYPHPNAME, 355 ::BasePeer::TYPE_COLNAME, 356 ::BasePeer::TYPE_FIELDNAME, 357 ::BasePeer::TYPE_NUM 358 ); 359 360 $book = new PropelModel::Book(); 357 361 $book->fromArray(array ( 358 362 'Title' => 'Harry Potter and the Order of the Phoenix', … … 361 365 362 366 $expecteds = array ( 363 BasePeer::TYPE_PHPNAME => array (367 ::BasePeer::TYPE_PHPNAME => array ( 364 368 'Title' => 'Harry Potter and the Order of the Phoenix', 365 369 'ISBN' => '043935806X' 366 370 ), 367 BasePeer::TYPE_STUDLYPHPNAME => array (371 ::BasePeer::TYPE_STUDLYPHPNAME => array ( 368 372 'title' => 'Harry Potter and the Order of the Phoenix', 369 373 'iSBN' => '043935806X' 370 374 ), 371 BasePeer::TYPE_COLNAME => array (375 ::BasePeer::TYPE_COLNAME => array ( 372 376 'book.TITLE' => 'Harry Potter and the Order of the Phoenix', 373 377 'book.ISBN' => '043935806X' 374 378 ), 375 BasePeer::TYPE_FIELDNAME => array (379 ::BasePeer::TYPE_FIELDNAME => array ( 376 380 'title' => 'Harry Potter and the Order of the Phoenix', 377 381 'isbn' => '043935806X' 378 382 ), 379 BasePeer::TYPE_NUM => array (383 ::BasePeer::TYPE_NUM => array ( 380 384 '1' => 'Harry Potter and the Order of the Phoenix', 381 385 '2' => '043935806X' … … 397 401 } 398 402 } 403 404 ?> trunk/generator/test/classes/propel/GeneratedNestedSetObjectTest.php
r1068 r1082 1 1 <?php 2 3 use bookstore::Peer as PropelPeer; 4 use bookstore::Model as PropelModel; 5 2 6 /* 3 7 * $Id: GeneratedNestedSetObjectTest.php 894 2007-12-27 14:39:01Z heltem $ … … 43 47 public function testObjectIsRootTrue() 44 48 { 45 $pp = P agePeer::retrieveRoot(1);49 $pp = PropelPeer::PagePeer::retrieveRoot(1); 46 50 $this->assertTrue($pp->isRoot(), 'Node must be root'); 47 51 } … … 52 56 public function testObjectIsRootFalse() 53 57 { 54 $c = new Criteria(PagePeer::DATABASE_NAME);55 $c->add(P agePeer::TITLE, 'school',Criteria::EQUAL);58 $c = new ::Criteria(PropelPeer::PagePeer::DATABASE_NAME); 59 $c->add(PropelPeer::PagePeer::TITLE, 'school', ::Criteria::EQUAL); 56 60 57 $school = P agePeer::doSelectOne($c);61 $school = PropelPeer::PagePeer::doSelectOne($c); 58 62 $this->assertFalse($school->isRoot(), 'Node must not be root'); 59 63 } … … 64 68 public function testObjectRetrieveParentTrue() 65 69 { 66 $c = new Criteria(PagePeer::DATABASE_NAME);67 $c->add(P agePeer::TITLE, 'school',Criteria::EQUAL);70 $c = new ::Criteria(PropelPeer::PagePeer::DATABASE_NAME); 71 $c->add(PropelPeer::PagePeer::TITLE, 'school', ::Criteria::EQUAL); 68 72 69 $school = P agePeer::doSelectOne($c);73 $school = PropelPeer::PagePeer::doSelectOne($c); 70 74 $this->assertNotNull($school->retrieveParent(), 'Parent node must exist'); 71 75 } … … 76 80 public function testObjectRetrieveParentFalse() 77 81 { 78 $c = new Criteria(PagePeer::DATABASE_NAME);79 $c->add(P agePeer::TITLE, 'home',Criteria::EQUAL);82 $c = new ::Criteria(PropelPeer::PagePeer::DATABASE_NAME); 83 $c->add(PropelPeer::PagePeer::TITLE, 'home', ::Criteria::EQUAL); 80 84 81 $home = P agePeer::doSelectOne($c);85 $home = PropelPeer::PagePeer::doSelectOne($c); 82 86 $this->assertNull($home->retrieveParent(), 'Parent node must not exist and retrieved not be null'); 83 87 } … … 88 92 public function testObjectHasParentTrue() 89 93 { 90 $c = new Criteria();91 $c->add(P agePeer::TITLE, 'school',Criteria::EQUAL);94 $c = new ::Criteria(); 95 $c->add(PropelPeer::PagePeer::TITLE, 'school', ::Criteria::EQUAL); 92 96 93 $school = P agePeer::doSelectOne($c);97 $school = PropelPeer::PagePeer::doSelectOne($c); 94 98 $this->assertTrue($school->hasParent(), 'Node must have parent node'); 95 99 } … … 100 104 public function testObjectHasParentFalse() 101 105 { 102 $c = new Criteria();103 $c->add(P agePeer::TITLE, 'home',Criteria::EQUAL);106 $c = new ::Criteria(); 107 $c->add(PropelPeer::PagePeer::TITLE, 'home', ::Criteria::EQUAL); 104 108 105 $home = P agePeer::doSelectOne($c);109 $home = PropelPeer::PagePeer::doSelectOne($c); 106 110 $this->assertFalse($home->hasParent(), 'Root node must not have parent'); 107 111 } … … 112 116 public function testObjectIsLeafTrue() 113 117 { 114 $c = new Criteria();115 $c->add(P agePeer::TITLE, 'simulator',Criteria::EQUAL);118 $c = new ::Criteria(); 119 $c->add(PropelPeer::PagePeer::TITLE, 'simulator', ::Criteria::EQUAL); 116 120 117 $simulator = P agePeer::doSelectOne($c);121 $simulator = PropelPeer::PagePeer::doSelectOne($c); 118 122 $this->assertTrue($simulator->isLeaf($simulator), 'Node must be a leaf'); 119 123 } … … 124 128 public function testObjectIsLeafFalse() 125 129 { 126 $c = new Criteria();127 $c->add(P agePeer::TITLE, 'contact',Criteria::EQUAL);130 $c = new ::Criteria(); 131 $c->add(PropelPeer::PagePeer::TITLE, 'contact', ::Criteria::EQUAL); 128 132 129 $contact = P agePeer::doSelectOne($c);133 $contact = PropelPeer::PagePeer::doSelectOne($c); 130 134 $this->assertFalse($contact->isLeaf($contact), 'Node must not be a leaf'); 131 135 } … … 136 140 public function testObjectMakeRoot() 137 141 { 138 $page = new P age();142 $page = new PropelModel::Page(); 139 143 $page->makeRoot(); 140 144 $this->assertEquals(1, $page->getLeftValue(), 'Node left value must equal 1'); … … 148 152 public function testObjectMakeRootException() 149 153 { 150 $c = new Criteria();151 $c->add(P agePeer::TITLE, 'home',Criteria::EQUAL);154 $c = new ::Criteria(); 155 $c->add(PropelPeer::PagePeer::TITLE, 'home', ::Criteria::EQUAL); 152 156 153 $home = P agePeer::doSelectOne($c);157 $home = PropelPeer::PagePeer::doSelectOne($c); 154 158 $home->makeRoot(); 155 159 } 156 160 157 161 } 162 163 ?> trunk/generator/test/classes/propel/GeneratedNestedSetPeerTest.php
r1068 r1082 1 1 <?php 2 3 use bookstore::Peer as PropelPeer; 4 use bookstore::Model as PropelModel; 5 2 6 /* 3 7 * $Id: GeneratedNestedSetPeerTest.php 989 2008-03-11 14:29:30Z heltem $ … … 43 47 public function testRetrieveRootExist() 44 48 { 45 $pp = P agePeer::retrieveRoot(1);49 $pp = PropelPeer::PagePeer::retrieveRoot(1); 46 50 $this->assertNotNull($pp, 'Node must exist and not be null'); 47 51 $this->assertEquals(1, $pp->getLeftValue(), 'Node left value must be equal to 1'); … … 53 57 public function testRetrieveRootNotExist() 54 58 { 55 $pp = P agePeer::retrieveRoot(2);59 $pp = PropelPeer::PagePeer::retrieveRoot(2); 56 60 $this->assertNull($pp, 'Root with such scopeId must not exist'); 57 61 } … … 62 66 public function testPeerIsRootTrue() 63 67 { 64 $pp = P agePeer::retrieveRoot(1);65 $this->assertTrue(P agePeer::isRoot($pp), 'Node must be root');68 $pp = PropelPeer::PagePeer::retrieveRoot(1); 69 $this->assertTrue(PropelPeer::PagePeer::isRoot($pp), 'Node must be root'); 66 70 } 67 71 … … 71 75 public function testPeerIsRootFalse() 72 76 { 73 $c = new Criteria(PagePeer::DATABASE_NAME);74 $c->add(P agePeer::TITLE, 'school',Criteria::EQUAL);75 76 $school = P agePeer::doSelectOne($c);77 $this->assertFalse(P agePeer::isRoot($school), 'Node must not be root');77 $c = new ::Criteria(PropelPeer::PagePeer::DATABASE_NAME); 78 $c->add(PropelPeer::PagePeer::TITLE, 'school', ::Criteria::EQUAL); 79 80 $school = PropelPeer::PagePeer::doSelectOne($c); 81 $this->assertFalse(PropelPeer::PagePeer::isRoot($school), 'Node must not be root'); 78 82 } 79 83 … … 83 87 public function testPeerRetrieveParentTrue() 84 88 { 85 $c = new Criteria(PagePeer::DATABASE_NAME);86 $c->add(P agePeer::TITLE, 'school',Criteria::EQUAL);87 88 $school = P agePeer::doSelectOne($c);89 $this->assertNotNull(P agePeer::retrieveParent($school), 'Parent node must exist');89 $c = new ::Criteria(PropelPeer::PagePeer::DATABASE_NAME); 90 $c->add(PropelPeer::PagePeer::TITLE, 'school', ::Criteria::EQUAL); 91 92 $school = PropelPeer::PagePeer::doSelectOne($c); 93 $this->assertNotNull(PropelPeer::PagePeer::retrieveParent($school), 'Parent node must exist'); 90 94 } 91 95 … … 95 99 public function testPeerRetrieveParentFalse() 96 100 { 97 $c = new Criteria(PagePeer::DATABASE_NAME);98 $c->add(P agePeer::TITLE, 'home',Criteria::EQUAL);99 100 $home = P agePeer::doSelectOne($c);101 $this->assertNull(P agePeer::retrieveParent($home), 'Parent node must not exist and retrieved not be null');101 $c = new ::Criteria(PropelPeer::PagePeer::DATABASE_NAME); 102 $c->add(PropelPeer::PagePeer::TITLE, 'home', ::Criteria::EQUAL); 103 104 $home = PropelPeer::PagePeer::doSelectOne($c); 105 $this->assertNull(PropelPeer::PagePeer::retrieveParent($home), 'Parent node must not exist and retrieved not be null'); 102 106 } 103 107 … … 107 111 public function testPeerHasParentTrue() 108 112 { 109 $c = new Criteria();110 $c->add(P agePeer::TITLE, 'school',Criteria::EQUAL);111 112 $school = P agePeer::doSelectOne($c);113 $this->assertTrue(P agePeer::hasParent($school), 'Node must have parent node');113 $c = new ::Criteria(); 114 $c->add(PropelPeer::PagePeer::TITLE, 'school', ::Criteria::EQUAL); 115 116 $school = PropelPeer::PagePeer::doSelectOne($c); 117 $this->assertTrue(PropelPeer::PagePeer::hasParent($school), 'Node must have parent node'); 114 118 } 115 119 … … 119 123 public function testPeerHasParentFalse() 120 124 { 121 $c = new Criteria();122 $c->add(P agePeer::TITLE, 'home',Criteria::EQUAL);123 124 $home = P agePeer::doSelectOne($c);125 $this->assertFalse(P agePeer::hasParent($home), 'Root node must not have parent');125 $c = new ::Criteria(); 126 $c->add(PropelPeer::PagePeer::TITLE, 'home', ::Criteria::EQUAL); 127 128 $home = PropelPeer::PagePeer::doSelectOne($c); 129 $this->assertFalse(PropelPeer::PagePeer::hasParent($home), 'Root node must not have parent'); 126 130 } 127 131 … … 131 135 public function testPeerIsValidTrue() 132 136 { 133 $c = new Criteria();134 $c->add(P agePeer::TITLE, 'school',Criteria::EQUAL);135 136 $school = P agePeer::doSelectOne($c);137 $this->assertTrue(P agePeer::isValid($school), 'Node must be valid');137 $c = new ::Criteria(); 138 $c->add(PropelPeer::PagePeer::TITLE, 'school', ::Criteria::EQUAL); 139 140 $school = PropelPeer::PagePeer::doSelectOne($c); 141 $this->assertTrue(PropelPeer::PagePeer::isValid($school), 'Node must be valid'); 138 142 } 139 143 … … 143 147 public function testPeerIsValidFalse() 144 148 { 145 $page = new P age();146 $this->assertFalse(P agePeer::isValid($page), 'Node left and right values must be invalid');147 $this->assertFalse(P agePeer::isValid(null), 'Null must be invalid');149 $page = new PropelModel::Page(); 150 $this->assertFalse(PropelPeer::PagePeer::isValid($page), 'Node left and right values must be invalid'); 151 $this->assertFalse(PropelPeer::PagePeer::isValid(null), 'Null must be invalid'); 148 152 } 149 153 … … 153 157 public function testPeerIsLeafTrue() 154 158 { 155 $c = new Criteria();156 $c->add(P agePeer::TITLE, 'simulator',Criteria::EQUAL);157 158 $simulator = P agePeer::doSelectOne($c);159 $this->assertTrue(P agePeer::isLeaf($simulator), 'Node must be a leaf');159 $c = new ::Criteria(); 160 $c->add(PropelPeer::PagePeer::TITLE, 'simulator', ::Criteria::EQUAL); 161 162 $simulator = PropelPeer::PagePeer::doSelectOne($c); 163 $this->assertTrue(PropelPeer::PagePeer::isLeaf($simulator), 'Node must be a leaf'); 160 164 } 161 165 … … 165 169 public function testPeerIsLeafFalse() 166 170 { 167 $c = new Criteria();168 $c->add(P agePeer::TITLE, 'contact',Criteria::EQUAL);169 170 $contact = P agePeer::doSelectOne($c);171 $this->assertFalse(P agePeer::isLeaf($contact), 'Node must not be a leaf');171 $c = new ::Criteria(); 172 $c->add(PropelPeer::PagePeer::TITLE, 'contact', ::Criteria::EQUAL); 173 174 $contact = PropelPeer::PagePeer::doSelectOne($c); 175 $this->assertFalse(PropelPeer::PagePeer::isLeaf($contact), 'Node must not be a leaf'); 172 176 } 173 177 … … 177 181 public function testPeerCreateRoot() 178 182 { 179 $page = new P age();180 P agePeer::createRoot($page);183 $page = new PropelModel::Page(); 184 PropelPeer::PagePeer::createRoot($page); 181 185 $this->assertEquals(1, $page->getLeftValue(), 'Node left value must equal 1'); 182 186 $this->assertEquals(2, $page->getRightValue(), 'Node right value must equal 2'); … … 189 193 public function testPeerCreateRootException() 190 194 { 191 $c = new Criteria();192 $c->add(P agePeer::TITLE, 'home',Criteria::EQUAL);193 194 $home = P agePeer::doSelectOne($c);195 P agePeer::createRoot($home);195 $c = new ::Criteria(); 196 $c->add(PropelPeer::PagePeer::TITLE, 'home', ::Criteria::EQUAL); 197 198 $home = PropelPeer::PagePeer::doSelectOne($c); 199 PropelPeer::PagePeer::createRoot($home); 196 200 } 197 201 198 202 } 203 204 ?> trunk/generator/test/classes/propel/GeneratedNestedSetTest.php
r1068 r1082 1 1 <?php
