1
0
mirror of synced 2025-01-30 20:11:49 +03:00

Collapse cascade all test

This commit is contained in:
Asmir Mustafic 2011-10-26 10:14:59 +02:00
parent cb76222e63
commit 035ca8e500

View File

@ -325,21 +325,23 @@ abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTest
$this->assertEquals('user', $class->associationMappings['address']['inversedBy']); $this->assertEquals('user', $class->associationMappings['address']['inversedBy']);
} }
/** /**
* @depends testOneToManyAssociationsAreExported * @depends testExportDirectoryAndFilesAreCreated
* @param ClassMetadataInfo $class
*/ */
public function testCascadeIsDetected($class) public function testCascadeAllCollapsed()
{ {
if(!isset($class->associationMappings['interests'])){ $type = $this->_getType();
$this->markTestSkipped('The "interests" association is not aviable.'); if ($type == 'xml') {
$xml = simplexml_load_file(__DIR__ . '/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.xml');
$xml->registerXPathNamespace("d", "http://doctrine-project.org/schemas/orm/doctrine-mapping");
$nodes = $xml->xpath("/d:doctrine-mapping/d:entity/d:one-to-many[@field='interests']/d:cascade/d:*");
$this->assertEquals(1, count($nodes));
$this->assertEquals('cascade-all', $nodes[0]->getName());
} else { } else {
$this->assertTrue($class->associationMappings['interests']['isCascadePersist']); $this->markTestSkipped('Test aviable only for XML dirver');
$this->assertTrue($class->associationMappings['interests']['isCascadeMerge']);
$this->assertTrue($class->associationMappings['interests']['isCascadeRemove']);
$this->assertTrue($class->associationMappings['interests']['isCascadeRefresh']);
$this->assertTrue($class->associationMappings['interests']['isCascadeDetach']);
} }
return $class;
} }
public function __destruct() public function __destruct()
{ {