Create failing test to reveal the issue
This commit is contained in:
parent
20cb50451d
commit
1d96178097
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Doctrine\Tests\ORM\Functional;
|
||||||
|
|
||||||
|
use Doctrine\Tests\Models\DDC3597\DDC3597Image;
|
||||||
|
use Doctrine\Tests\Models\DDC3597\DDC3597Media;
|
||||||
|
use Doctrine\Tests\Models\DDC3597\DDC3597Root;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class EntityListenersOnMergeTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||||
|
{
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->_schemaTool->createSchema(
|
||||||
|
[
|
||||||
|
$this->_em->getClassMetadata(DDC3597Root::class),
|
||||||
|
$this->_em->getClassMetadata(DDC3597Media::class),
|
||||||
|
$this->_em->getClassMetadata(DDC3597Image::class),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
$this->_schemaTool->dropSchema(
|
||||||
|
[
|
||||||
|
$this->_em->getClassMetadata(DDC3597Root::class),
|
||||||
|
$this->_em->getClassMetadata(DDC3597Media::class),
|
||||||
|
$this->_em->getClassMetadata(DDC3597Image::class),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMergeNewEntityLifecyleEventsModificationsShouldBeKept()
|
||||||
|
{
|
||||||
|
$imageEntity = new DDC3597Image('foobar');
|
||||||
|
$imageEntity->setFormat('JPG');
|
||||||
|
$imageEntity->setSize(123);
|
||||||
|
$imageEntity->getDimension()->setWidth(300);
|
||||||
|
$imageEntity->getDimension()->setHeight(500);
|
||||||
|
|
||||||
|
$imageEntity = $this->_em->merge($imageEntity);
|
||||||
|
|
||||||
|
$this->assertNotNull($imageEntity->getCreatedAt());
|
||||||
|
$this->assertNotNull($imageEntity->getUpdatedAt());
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user