Commit 1d60c65d authored by jwage's avatar jwage

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

parent 9b596895
......@@ -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;
......
......@@ -45,6 +45,8 @@ $metadata->mapOneToOne(array(
array(
'name' => 'address_id',
'referencedColumnName' => 'id',
'onDelete' => 'CASCADE',
'onUpdate' => 'CASCADE'
),
),
'orphanRemoval' => false,
......
......@@ -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">
......
......@@ -22,6 +22,8 @@ Doctrine\Tests\ORM\Mapping\User:
joinColumn:
name: address_id
referencedColumnName: id
onDelete: CASCADE
onUpdate: CASCADE
cascade: [ remove ]
oneToMany:
phonenumbers:
......
......@@ -45,4 +45,4 @@ class User
$address->setUser($this);
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment