1
0
mirror of synced 2025-02-20 22:23:14 +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

@ -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') {
}else{ $xml = simplexml_load_file(__DIR__ . '/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.xml');
$this->assertTrue($class->associationMappings['interests']['isCascadePersist']);
$this->assertTrue($class->associationMappings['interests']['isCascadeMerge']); $xml->registerXPathNamespace("d", "http://doctrine-project.org/schemas/orm/doctrine-mapping");
$this->assertTrue($class->associationMappings['interests']['isCascadeRemove']); $nodes = $xml->xpath("/d:doctrine-mapping/d:entity/d:one-to-many[@field='interests']/d:cascade/d:*");
$this->assertTrue($class->associationMappings['interests']['isCascadeRefresh']); $this->assertEquals(1, count($nodes));
$this->assertTrue($class->associationMappings['interests']['isCascadeDetach']);
$this->assertEquals('cascade-all', $nodes[0]->getName());
} else {
$this->markTestSkipped('Test aviable only for XML dirver');
} }
return $class;
} }
public function __destruct() public function __destruct()
{ {