1
0
mirror of synced 2024-12-05 03:06:05 +03:00

[2.0] Adding test to ensure onDelete and onUpdate are read properly from all mapping drivers

This commit is contained in:
jwage 2010-03-17 14:20:18 +00:00
parent 9b5968957d
commit 1d60c65daf
5 changed files with 19 additions and 2 deletions

View File

@ -189,6 +189,18 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase
return $class;
}
/**
* @depends testColumnDefinition
* @param ClassMetadata $class
*/
public function testJoinColumnOnDeleteAndOnUpdate($class)
{
$this->assertEquals('CASCADE', $class->associationMappings['address']->joinColumns[0]['onDelete']);
$this->assertEquals('CASCADE', $class->associationMappings['address']->joinColumns[0]['onUpdate']);
return $class;
}
}
/**
@ -213,6 +225,7 @@ class User
/**
* @OneToOne(targetEntity="Address", cascade={"remove"})
* @JoinColumn(onDelete="CASCADE", onUpdate="CASCADE")
*/
public $address;

View File

@ -45,6 +45,8 @@ $metadata->mapOneToOne(array(
array(
'name' => 'address_id',
'referencedColumnName' => 'id',
'onDelete' => 'CASCADE',
'onUpdate' => 'CASCADE'
),
),
'orphanRemoval' => false,

View File

@ -22,7 +22,7 @@
<one-to-one field="address" target-entity="Address">
<cascade><cascade-remove /></cascade>
<join-column name="address_id" referenced-column-name="id"/>
<join-column name="address_id" referenced-column-name="id" on-delete="CASCADE" on-update="CASCADE"/>
</one-to-one>
<one-to-many field="phonenumbers" target-entity="Phonenumber" mapped-by="user">

View File

@ -22,6 +22,8 @@ Doctrine\Tests\ORM\Mapping\User:
joinColumn:
name: address_id
referencedColumnName: id
onDelete: CASCADE
onUpdate: CASCADE
cascade: [ remove ]
oneToMany:
phonenumbers:

View File

@ -45,4 +45,4 @@ class User
$address->setUser($this);
}
}
}
}