Changeset 4776 for trunk/tests
- Timestamp:
- 08/16/08 20:40:59 (5 months ago)
- Location:
- trunk/tests
- Files:
-
- 3 added
- 11 modified
-
lib/mocks/Doctrine_ConnectionMock.php (modified) (3 diffs)
-
models/cms/CmsArticle.php (modified) (1 diff)
-
models/cms/CmsUser.php (modified) (1 diff)
-
models/forum/ForumAvatar.php (added)
-
models/forum/ForumBoard.php (modified) (1 diff)
-
models/forum/ForumCategory.php (modified) (1 diff)
-
models/forum/ForumUser.php (modified) (2 diffs)
-
Orm/AllTests.php (modified) (2 diffs)
-
Orm/Associations/OneToOneMappingTest.php (modified) (3 diffs)
-
Orm/Component/AccessTest.php (modified) (4 diffs)
-
Orm/EntityManagerTest.php (added)
-
Orm/EntityPersisterTest.php (added)
-
Orm/Hydration/BasicHydrationTest.php (modified) (9 diffs)
-
Orm/Query/IdentifierRecognitionTest.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/lib/mocks/Doctrine_ConnectionMock.php
r4723 r4776 9 9 private $_sequenceModuleMock; 10 10 private $_platformMock; 11 private $_inserts = array(); 11 12 12 13 public function __construct(array $params) … … 31 32 } 32 33 34 /** 35 * @override 36 */ 37 public function insert($tableName, array $data) 38 { 39 $this->_inserts[$tableName][] = $data; 40 } 41 33 42 /* Mock API */ 34 43 … … 42 51 $this->_sequenceModuleMock = $seqManager; 43 52 } 53 54 public function getInserts() 55 { 56 return $this->_inserts; 57 } 58 59 public function reset() 60 { 61 $this->_inserts = array(); 62 } 44 63 } 45 64 -
trunk/tests/models/cms/CmsArticle.php
r4718 r4776 35 35 'length' => 4 36 36 )); 37 $mapping->hasMany('CmsComment as comments', array( 38 'local' => 'id', 'foreign' => 'article_id')); 37 38 /*$mapping->hasMany('CmsComment as comments', array( 39 'local' => 'id', 'foreign' => 'article_id'));*/ 40 41 $mapping->mapOneToMany(array( 42 'fieldName' => 'comments', 43 'targetEntity' => 'CmsComment', 44 )); 45 46 /*$mapping->mapManyToOne(array( 47 'fieldName' => 'author', 48 'joinColumns' => array('user_id' => 'id') 49 ));*/ 39 50 } 40 51 } -
trunk/tests/models/cms/CmsUser.php
r4718 r4776 37 37 )); 38 38 39 $mapping->hasMany('CmsPhonenumber as phonenumbers', array(39 /*$mapping->hasMany('CmsPhonenumber as phonenumbers', array( 40 40 'local' => 'id', 'foreign' => 'user_id')); 41 41 $mapping->hasMany('CmsArticle as articles', array( 42 'local' => 'id', 'foreign' => 'user_id')); 42 'local' => 'id', 'foreign' => 'user_id'));*/ 43 44 $mapping->mapOneToMany(array( 45 'fieldName' => 'phonenumbers', 46 'targetEntity' => 'CmsPhonenumber', 47 48 )); 49 50 $mapping->mapOneToMany(array( 51 'fieldName' => 'articles', 52 'targetEntity' => 'CmsArticle', 53 )); 54 43 55 } 44 56 } -
trunk/tests/models/forum/ForumBoard.php
r4699 r4776 26 26 )); 27 27 28 $mapping->hasOne('ForumCategory as category',29 array('local' => 'category_id', 'foreign' => 'id')); 30 /*31 $m etadata->mapOneToOne(array(32 'fieldName' => 'category', // optional, defaults to targetEntity28 /*$mapping->hasOne('ForumCategory as category', 29 array('local' => 'category_id', 'foreign' => 'id'));*/ 30 31 $mapping->mapOneToOne(array( 32 'fieldName' => 'category', 33 33 'targetEntity' => 'ForumCategory', 34 34 'joinColumns' => array('category_id' => 'id') 35 )); 36 */ 35 )); 37 36 } 38 37 } -
trunk/tests/models/forum/ForumCategory.php
r4699 r4776 21 21 )); 22 22 23 $mapping->hasMany('ForumBoard as boards', array( 24 'local' => 'id' , 'foreign' => 'category_id')); 23 /*$mapping->hasMany('ForumBoard as boards', array( 24 'local' => 'id' , 'foreign' => 'category_id'));*/ 25 26 $mapping->mapOneToMany(array( 27 'fieldName' => 'boards', 28 'targetEntity' => 'ForumBoard' 29 )); 25 30 } 26 31 } -
trunk/tests/models/forum/ForumUser.php
r4718 r4776 7 7 class ForumUser extends Doctrine_Entity 8 8 { 9 #protected $dtype;10 9 #protected $id; 11 10 #protected $username; 11 #protected $avatar; 12 12 13 13 public static function initMetadata($mapping) … … 43 43 )); 44 44 45 $mapping->mapOneToOne(array( 46 'fieldName' => 'avatar', 47 'targetEntity' => 'ForumAvatar', 48 'joinColumns' => array('avatar_id' => 'id'), 49 )); 50 45 51 } 46 52 -
trunk/tests/Orm/AllTests.php
r4523 r4776 16 16 require_once 'Orm/UnitOfWorkTest.php'; 17 17 require_once 'Orm/EntityManagerFactoryTest.php'; 18 require_once 'Orm/EntityManagerTest.php'; 19 require_once 'Orm/EntityPersisterTest.php'; 18 20 19 21 class Orm_AllTests … … 30 32 $suite->addTestSuite('Orm_UnitOfWorkTest'); 31 33 $suite->addTestSuite('Orm_EntityManagerFactoryTest'); 32 //$suite->addTestSuite('Orm_ConfigurableTestCase'); 34 $suite->addTestSuite('Orm_EntityManagerTest'); 35 $suite->addTestSuite('Orm_EntityPersisterTest'); 33 36 34 37 $suite->addTest(Orm_Component_AllTests::suite()); -
trunk/tests/Orm/Associations/OneToOneMappingTest.php
r4699 r4776 10 10 'targetEntity' => 'Address', 11 11 'joinColumns' => array('address_id' => 'id'), 12 'sourceEntity' => 'Person' // This is normally filled by ClassMetadata12 'sourceEntity' => 'Person', // This is normally filled by ClassMetadata 13 13 ); 14 14 … … 24 24 25 25 $inverseSideMapping = array( 26 'fieldName' => 'person', 27 'sourceEntity' => 'Address', 28 'targetEntity' => 'Person', 26 29 'mappedBy' => 'address' 27 30 ); … … 29 32 $oneToOneMapping = new Doctrine_Association_OneToOne($inverseSideMapping); 30 33 $this->assertEquals('address', $oneToOneMapping->getMappedByFieldName()); 34 $this->assertEquals('Address', $oneToOneMapping->getSourceEntityName()); 35 $this->assertEquals('Person', $oneToOneMapping->getTargetEntityName()); 31 36 $this->assertTrue($oneToOneMapping->isInverseSide()); 32 37 -
trunk/tests/Orm/Component/AccessTest.php
r4374 r4776 27 27 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL 28 28 * @link www.phpdoctrine.org 29 * @since 1.029 * @since 2.0 30 30 * @version $Revision: 3754 $ 31 31 */ … … 98 98 /** 99 99 * @test 100 */101 public function shouldSetArrayOfValusInRecord()102 {103 $this->user->setArray(array(104 'username' => 'meus',105 'id' => 22));106 107 $this->assertEquals('meus', $this->user->username);108 $this->assertEquals('meus', $this->user['username']);109 110 $this->assertEquals(22, $this->user->id);111 $this->assertEquals(22, $this->user['id']);112 }113 114 115 /**116 * @test117 100 * @expectedException Doctrine_Entity_Exception 118 101 */ … … 129 112 { 130 113 $this->user['rat'] = 'meus'; 131 }132 133 /**134 * @test135 * @expectedException Doctrine_Entity_Exception136 */137 public function shouldNotBeAbleToSetNonExistantFieldAsPartInSetArray()138 {139 $this->user->setArray(array(140 'rat' => 'meus',141 'id' => 22));142 114 } 143 115 … … 175 147 unset($col->test); 176 148 $this->assertFalse(isset($col->test)); 177 }178 179 180 /**181 *182 * @test183 * @expectedException Doctrine_Exception184 */185 public function shouldNotBeAbleToSetNullFieldInRecord()186 {187 $this->user->offsetSet(null, 'test');188 189 149 } 190 150 -
trunk/tests/Orm/Hydration/BasicHydrationTest.php
r4523 r4776 124 124 'metadata' => $this->_em->getClassMetadata('CmsPhonenumber'), 125 125 'parent' => 'u', 126 'relation' => $this->_em->getClassMetadata('CmsUser')->get Relation('phonenumbers'),126 'relation' => $this->_em->getClassMetadata('CmsUser')->getAssociationMapping('phonenumbers'), 127 127 'map' => null 128 128 ) … … 227 227 'metadata' => $this->_em->getClassMetadata('CmsPhonenumber'), 228 228 'parent' => 'u', 229 'relation' => $this->_em->getClassMetadata('CmsUser')->get Relation('phonenumbers'),229 'relation' => $this->_em->getClassMetadata('CmsUser')->getAssociationMapping('phonenumbers'), 230 230 'map' => null, 231 231 'agg' => array('0' => 'numPhones') … … 312 312 'metadata' => $this->_em->getClassMetadata('CmsPhonenumber'), 313 313 'parent' => 'u', 314 'relation' => $this->_em->getClassMetadata('CmsUser')->get Relation('phonenumbers'),314 'relation' => $this->_em->getClassMetadata('CmsUser')->getAssociationMapping('phonenumbers'), 315 315 'map' => 'phonenumber' 316 316 ) … … 416 416 'metadata' => $this->_em->getClassMetadata('CmsPhonenumber'), 417 417 'parent' => 'u', 418 'relation' => $this->_em->getClassMetadata('CmsUser')->get Relation('phonenumbers'),418 'relation' => $this->_em->getClassMetadata('CmsUser')->getAssociationMapping('phonenumbers'), 419 419 'map' => null 420 420 ), … … 422 422 'metadata' => $this->_em->getClassMetadata('CmsArticle'), 423 423 'parent' => 'u', 424 'relation' => $this->_em->getClassMetadata('CmsUser')->get Relation('articles'),424 'relation' => $this->_em->getClassMetadata('CmsUser')->getAssociationMapping('articles'), 425 425 'map' => null 426 426 ), … … 572 572 'metadata' => $this->_em->getClassMetadata('CmsPhonenumber'), 573 573 'parent' => 'u', 574 'relation' => $this->_em->getClassMetadata('CmsUser')->get Relation('phonenumbers'),574 'relation' => $this->_em->getClassMetadata('CmsUser')->getAssociationMapping('phonenumbers'), 575 575 'map' => null 576 576 ), … … 578 578 'metadata' => $this->_em->getClassMetadata('CmsArticle'), 579 579 'parent' => 'u', 580 'relation' => $this->_em->getClassMetadata('CmsUser')->get Relation('articles'),580 'relation' => $this->_em->getClassMetadata('CmsUser')->getAssociationMapping('articles'), 581 581 'map' => null 582 582 ), … … 584 584 'metadata' => $this->_em->getClassMetadata('CmsComment'), 585 585 'parent' => 'a', 586 'relation' => $this->_em->getClassMetadata('CmsArticle')->get Relation('comments'),586 'relation' => $this->_em->getClassMetadata('CmsArticle')->getAssociationMapping('comments'), 587 587 'map' => null 588 588 ), … … 780 780 'metadata' => $this->_em->getClassMetadata('ForumBoard'), 781 781 'parent' => 'c', 782 'relation' => $this->_em->getClassMetadata('ForumCategory')->get Relation('boards'),782 'relation' => $this->_em->getClassMetadata('ForumCategory')->getAssociationMapping('boards'), 783 783 'map' => null 784 784 ), -
trunk/tests/Orm/Query/IdentifierRecognitionTest.php
r4523 r4776 85 85 86 86 $this->assertTrue($decl['metadata'] instanceof Doctrine_ClassMetadata); 87 $this->assertTrue($decl['relation'] instanceof Doctrine_ Relation);87 $this->assertTrue($decl['relation'] instanceof Doctrine_Association); 88 88 $this->assertEquals('u', $decl['parent']); 89 89 $this->assertEquals(null, $decl['scalar']); … … 109 109 110 110 $this->assertTrue($decl['metadata'] instanceof Doctrine_ClassMetadata); 111 $this->assertTrue($decl['relation'] instanceof Doctrine_ Relation);111 $this->assertTrue($decl['relation'] instanceof Doctrine_Association); 112 112 $this->assertEquals('u', $decl['parent']); 113 113 $this->assertEquals(null, $decl['scalar']); … … 117 117 118 118 $this->assertTrue($decl['metadata'] instanceof Doctrine_ClassMetadata); 119 $this->assertTrue($decl['relation'] instanceof Doctrine_ Relation);119 $this->assertTrue($decl['relation'] instanceof Doctrine_Association); 120 120 $this->assertEquals('u', $decl['parent']); 121 121 $this->assertEquals(null, $decl['scalar']);