#1169 DDC-3343 - removing duplicate test method
This commit is contained in:
parent
4bed15b984
commit
c6e7a81849
@ -6,7 +6,6 @@ use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
|||||||
use Doctrine\Tests\Models\Tweet\Tweet;
|
use Doctrine\Tests\Models\Tweet\Tweet;
|
||||||
use Doctrine\Tests\Models\Tweet\User;
|
use Doctrine\Tests\Models\Tweet\User;
|
||||||
use Doctrine\Tests\Models\Tweet\UserList;
|
use Doctrine\Tests\Models\Tweet\UserList;
|
||||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../../TestInit.php';
|
require_once __DIR__ . '/../../TestInit.php';
|
||||||
|
|
||||||
@ -29,6 +28,7 @@ class ExtraLazyCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$this->useModelSet('tweet');
|
$this->useModelSet('tweet');
|
||||||
$this->useModelSet('cms');
|
$this->useModelSet('cms');
|
||||||
$this->useModelSet('tweet');
|
$this->useModelSet('tweet');
|
||||||
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
@ -655,7 +655,6 @@ class ExtraLazyCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
|
|
||||||
$this->topic = $article1->topic;
|
$this->topic = $article1->topic;
|
||||||
$this->phonenumber = $phonenumber1->phonenumber;
|
$this->phonenumber = $phonenumber1->phonenumber;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -739,27 +738,6 @@ class ExtraLazyCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$this->assertCount(1, $user->tweets, 'Element was not removed - need to update the owning side first');
|
$this->assertCount(1, $user->tweets, 'Element was not removed - need to update the owning side first');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int[] ordered tuple: user id and tweet id
|
|
||||||
*/
|
|
||||||
private function loadTweetFixture()
|
|
||||||
{
|
|
||||||
$user = new User();
|
|
||||||
$tweet = new Tweet();
|
|
||||||
|
|
||||||
$user->name = 'ocramius';
|
|
||||||
$tweet->content = 'The cat is on the table';
|
|
||||||
|
|
||||||
$user->addTweet($tweet);
|
|
||||||
|
|
||||||
$this->_em->persist($user);
|
|
||||||
$this->_em->persist($tweet);
|
|
||||||
$this->_em->flush();
|
|
||||||
$this->_em->clear();
|
|
||||||
|
|
||||||
return array($user->id, $tweet->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group DDC-3343
|
* @group DDC-3343
|
||||||
*/
|
*/
|
||||||
@ -805,37 +783,6 @@ class ExtraLazyCollectionTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$this->assertNull($tweet->author, 'Tweet author link has been removed');
|
$this->assertNull($tweet->author, 'Tweet author link has been removed');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @group DDC-3343
|
|
||||||
*/
|
|
||||||
public function testRemovingManagedLazyProxyFromExtraLazyOneToManyDoesRemoveTheAssociationButNotTheEntity()
|
|
||||||
{
|
|
||||||
list($userId, $tweetId) = $this->loadTweetFixture();
|
|
||||||
|
|
||||||
/* @var $user User */
|
|
||||||
$user = $this->_em->find(User::CLASSNAME, $userId);
|
|
||||||
$tweet = $this->_em->getReference(Tweet::CLASSNAME, $tweetId);
|
|
||||||
|
|
||||||
$user->tweets->removeElement($this->_em->getReference(Tweet::CLASSNAME, $tweetId));
|
|
||||||
|
|
||||||
$this->_em->clear();
|
|
||||||
|
|
||||||
/* @var $tweet Tweet */
|
|
||||||
$tweet = $this->_em->find(Tweet::CLASSNAME, $tweet->id);
|
|
||||||
$this->assertInstanceOf(
|
|
||||||
Tweet::CLASSNAME,
|
|
||||||
$tweet,
|
|
||||||
'Even though the collection is extra lazy, the tweet should not have been deleted'
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->assertNull($tweet->author);
|
|
||||||
|
|
||||||
/* @var $user User */
|
|
||||||
$user = $this->_em->find(User::CLASSNAME, $userId);
|
|
||||||
|
|
||||||
$this->assertCount(0, $user->tweets);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group DDC-3343
|
* @group DDC-3343
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user