1
0
mirror of synced 2025-01-25 09:41:40 +03:00

51 lines
1.3 KiB
PHP
Raw Normal View History

2013-11-04 12:40:51 +01:00
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Tests\Models\DDC2775\AdminRole;
use Doctrine\Tests\Models\DDC2775\Authorization;
use Doctrine\Tests\Models\DDC2775\User;
2013-12-14 19:57:53 +01:00
use Doctrine\Tests\OrmFunctionalTestCase;
2013-11-04 12:40:51 +01:00
/**
* Functional tests for cascade remove with class table inheritance.
*
* @author Matthieu Napoli <matthieu@mnapoli.fr>
*/
2013-12-14 19:57:53 +01:00
class DDC2775Test extends OrmFunctionalTestCase
2013-11-04 12:40:51 +01:00
{
protected function setUp() {
$this->useModelSet('ddc2775');
parent::setUp();
}
/**
* @group DDC-2775
*/
public function testIssueCascadeRemove()
{
$user = new User();
$role = new AdminRole();
$user->addRole($role);
$authorization = new Authorization();
$user->addAuthorization($authorization);
$role->addAuthorization($authorization);
$this->_em->persist($user);
$this->_em->flush();
// Need to clear so that associations are lazy-loaded
$this->_em->clear();
2013-12-14 19:57:53 +01:00
$user = $this->_em->find('Doctrine\Tests\Models\DDC2775\User', $user->id);
2013-11-04 12:40:51 +01:00
$this->_em->remove($user);
$this->_em->flush();
// With the bug, the second flush throws an error because the cascade remove didn't work correctly
$this->_em->flush();
}
}