1
0
mirror of synced 2025-02-02 21:41:45 +03:00

#6284 simplifying tests to a minimum, removing unused auto-generated id field

This commit is contained in:
Marco Pivetta 2017-08-22 21:11:03 +02:00
parent c7281f6ade
commit 3842ad8ea1
No known key found for this signature in database
GPG Key ID: 4167D3337FD9D629

View File

@ -26,9 +26,9 @@ final class GH6217Test extends OrmFunctionalTestCase
*/
public function testRetrievingCacheShouldNotThrowUndefinedIndexException()
{
$user = new GH6217User(1);
$user = new GH6217User();
$profile = new GH6217Profile();
$category = new GH6217Category(1);
$category = new GH6217Category();
$userProfile = new GH6217UserProfile($user, $profile, $category);
$this->_em->persist($category);
@ -39,7 +39,7 @@ final class GH6217Test extends OrmFunctionalTestCase
$this->_em->clear();
$repository = $this->_em->getRepository(GH6217UserProfile::class);
$filters = ['user' => 1, 'category' => 1];
$filters = ['user' => $user->id, 'category' => $category->id];
$this->assertCount(1, $repository->findBy($filters));
$queryCount = $this->getCurrentQueryCount();
@ -59,15 +59,16 @@ class GH6217User
{
/**
* @Id
* @Column(type="integer")
* @Column(type="string")
* @GeneratedValue(strategy="NONE")
*
* @var int
* @var string
*/
public $id;
public function __construct(int $id)
public function __construct()
{
$this->id = $id;
$this->id = uniqid(self::class, true);
}
}
@ -97,15 +98,16 @@ class GH6217Category
{
/**
* @Id
* @Column(type="integer")
* @Column(type="string")
* @GeneratedValue(strategy="NONE")
*
* @var int
* @var string
*/
public $id;
public function __construct(int $id)
public function __construct()
{
$this->id = $id;
$this->id = uniqid(self::class, true);
}
}
@ -119,7 +121,6 @@ class GH6217UserProfile
* @Id
* @Cache("NONSTRICT_READ_WRITE")
* @ManyToOne(targetEntity="GH6217User")
* @JoinColumn(nullable=false)
*
* @var GH6217User
*/