1
0
mirror of synced 2025-01-18 14:31:40 +03:00

Collapse cascade all test (YAML too)

This commit is contained in:
Asmir Mustafic 2011-10-26 10:59:15 +02:00
parent 035ca8e500
commit d09285e9d3
4 changed files with 19 additions and 3 deletions

View File

@ -147,6 +147,9 @@ class YamlExporter extends AbstractExporter
if ($associationMapping['isCascadeDetach']) { if ($associationMapping['isCascadeDetach']) {
$cascade[] = 'detach'; $cascade[] = 'detach';
} }
if (count($cascade) === 5) {
$cascade = array('all');
}
$associationMappingArray = array( $associationMappingArray = array(
'targetEntity' => $associationMapping['targetEntity'], 'targetEntity' => $associationMapping['targetEntity'],
'cascade' => $cascade, 'cascade' => $cascade,

View File

@ -338,9 +338,17 @@ abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTest
$this->assertEquals(1, count($nodes)); $this->assertEquals(1, count($nodes));
$this->assertEquals('cascade-all', $nodes[0]->getName()); $this->assertEquals('cascade-all', $nodes[0]->getName());
} elseif ($type == 'yaml') {
$yaml = new \Symfony\Component\Yaml\Parser();
$value = $yaml->parse(file_get_contents(__DIR__ . '/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.yml'));
$this->assertTrue(isset($value['Doctrine\Tests\ORM\Tools\Export\ExportedUser']['oneToMany']['interests']['cascade']));
$this->assertEquals(1, count($value['Doctrine\Tests\ORM\Tools\Export\ExportedUser']['oneToMany']['interests']['cascade']));
$this->assertEquals('all', $value['Doctrine\Tests\ORM\Tools\Export\ExportedUser']['oneToMany']['interests']['cascade'][0]);
} else { } else {
$this->markTestSkipped('Test aviable only for XML dirver'); $this->markTestSkipped('Test aviable only for '.$type.' dirver');
} }
} }
public function __destruct() public function __destruct()

View File

@ -34,6 +34,11 @@ Doctrine\Tests\ORM\Tools\Export\User:
number: ASC number: ASC
cascade: [ persist, merge ] cascade: [ persist, merge ]
orphanRemoval: true orphanRemoval: true
interests:
targetEntity: Doctrine\Tests\ORM\Tools\Export\Interests
mappedBy: user
cascade: [ persist, merge, remove, refresh, detach ]
orphanRemoval: true
manyToMany: manyToMany:
groups: groups:
targetEntity: Doctrine\Tests\ORM\Tools\Export\Group targetEntity: Doctrine\Tests\ORM\Tools\Export\Group