1
0
mirror of synced 2025-01-19 06:51:40 +03:00
doctrine2/tests/Doctrine/Tests/ORM/Functional/MergeCompositeToOneKeyTest.php

45 lines
1.2 KiB
PHP
Raw Normal View History

2014-11-07 14:14:54 +01:00
<?php
namespace Doctrine\Tests\ORM\Functional;
use Doctrine\Tests\Models\MixedToOneIdentity\CompositeToOneKeyState;
use Doctrine\Tests\Models\MixedToOneIdentity\Country;
2014-11-07 14:14:54 +01:00
class MergeCompositeToOneKeyTest extends \Doctrine\Tests\OrmFunctionalTestCase
{
/**
* {@inheritDoc}
*/
2014-11-07 14:14:54 +01:00
protected function setUp()
{
parent::setUp();
2014-11-07 14:14:54 +01:00
$this->_schemaTool->createSchema(array(
$this->_em->getClassMetadata(Country::CLASSNAME),
$this->_em->getClassMetadata(CompositeToOneKeyState::CLASSNAME),
2014-11-07 14:14:54 +01:00
));
}
/**
* @group DDC-3378
* @group 1176
*/
public function testMergingOfEntityWithCompositeIdentifierContainingToOneAssociation()
2014-11-07 14:14:54 +01:00
{
$country = new Country();
2014-11-07 14:14:54 +01:00
$country->country = 'US';
$state = new CompositeToOneKeyState();
$state->state = 'CA';
$state->country = $country;
2014-11-07 14:14:54 +01:00
/* @var $merged CompositeToOneKeyState */
$merged = $this->_em->merge($state);
2014-11-07 14:14:54 +01:00
$this->assertInstanceOf(CompositeToOneKeyState::CLASSNAME, $state);
$this->assertNotSame($state, $merged);
$this->assertInstanceOf(Country::CLASSNAME, $merged->country);
$this->assertNotSame($country, $merged->country);
}
2014-11-07 14:14:54 +01:00
}