1
0
mirror of synced 2025-02-03 05:49:25 +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:08:06 +02:00
parent a8453dda89
commit c7281f6ade
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() public function testRetrievingCacheShouldNotThrowUndefinedIndexException()
{ {
$user = new GH6217User(1, 'user 1'); $user = new GH6217User(1);
$profile = new GH6217Profile(1); $profile = new GH6217Profile();
$category = new GH6217Category(1, 'category 1'); $category = new GH6217Category(1);
$userProfile = new GH6217UserProfile($user, $profile, $category); $userProfile = new GH6217UserProfile($user, $profile, $category);
$this->_em->persist($category); $this->_em->persist($category);
@ -65,37 +65,27 @@ class GH6217User
*/ */
public $id; public $id;
/** public function __construct(int $id)
* @Column(type="string", length=60, unique=true)
*
* @var string
*/
public $username;
public function __construct(int $id, string $username)
{ {
$this->id = $id; $this->id = $id;
$this->username = $username;
} }
} }
/** /** @Entity @Cache(usage="NONSTRICT_READ_WRITE") */
* @Entity
* @Cache(usage="NONSTRICT_READ_WRITE")
*/
class GH6217Profile class GH6217Profile
{ {
/** /**
* @Id * @Id
* @Column(type="integer") * @Column(type="string")
* @GeneratedValue(strategy="NONE")
* *
* @var int * @var string
*/ */
public $id; public $id;
public function __construct(int $id) public function __construct()
{ {
$this->id = $id; $this->id = uniqid(self::class, true);
} }
} }