| @@ 37-64 (lines=28) @@ | ||
| 34 | /** |
|
| 35 | * |
|
| 36 | */ |
|
| 37 | public function testCreateOneToOne() |
|
| 38 | { |
|
| 39 | $factory = new RelationFactory( |
|
| 40 | $this->oneToOneRelationClass, |
|
| 41 | $this->manyToOneRelationClass, |
|
| 42 | $this->oneToManyRelationClass, |
|
| 43 | $this->manyToManyRelationClass |
|
| 44 | ); |
|
| 45 | $this->assertInstanceOf( |
|
| 46 | $this->classImplement, |
|
| 47 | $factory->create( |
|
| 48 | DataMapper::RELATION_ONE_TO_ONE, |
|
| 49 | array( |
|
| 50 | '_relation' => array( |
|
| 51 | 'table' => 'test', |
|
| 52 | 'targetEntity' => 'test', |
|
| 53 | 'joinColumn' => array( |
|
| 54 | 'name' => 'test', |
|
| 55 | 'referencedColumnName' => 'id' |
|
| 56 | ), |
|
| 57 | ), |
|
| 58 | '_data' => array( |
|
| 59 | 'test' => array() |
|
| 60 | ) |
|
| 61 | ) |
|
| 62 | ) |
|
| 63 | ); |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * |
|
| @@ 69-97 (lines=29) @@ | ||
| 66 | /** |
|
| 67 | * |
|
| 68 | */ |
|
| 69 | public function testCreateManyToOne() |
|
| 70 | { |
|
| 71 | $factory = new RelationFactory( |
|
| 72 | $this->oneToOneRelationClass, |
|
| 73 | $this->manyToOneRelationClass, |
|
| 74 | $this->oneToManyRelationClass, |
|
| 75 | $this->manyToManyRelationClass |
|
| 76 | ); |
|
| 77 | ||
| 78 | $this->assertInstanceOf( |
|
| 79 | $this->classImplement, |
|
| 80 | $factory->create( |
|
| 81 | DataMapper::RELATION_MANY_TO_ONE, |
|
| 82 | array( |
|
| 83 | '_relation' => array( |
|
| 84 | 'table' => 'test', |
|
| 85 | 'targetEntity' => 'test', |
|
| 86 | 'joinColumn' => array( |
|
| 87 | 'name' => 'test', |
|
| 88 | 'referencedColumnName' => 'id' |
|
| 89 | ), |
|
| 90 | ), |
|
| 91 | '_data' => array( |
|
| 92 | 'test' => array() |
|
| 93 | ) |
|
| 94 | ) |
|
| 95 | ) |
|
| 96 | ); |
|
| 97 | } |
|
| 98 | ||
| 99 | /** |
|
| 100 | * |
|