コード例 #1
0
 /**
  * @depends testCanCreateEntity
  */
 public function testCanUpdateEntityWithReference(Shopware\Models\Customer\Customer $customer)
 {
     $groupId = $customer->getGroup()->getId();
     $groupKey = $customer->getGroup()->getKey();
     $customer = new Customer();
     $customer->setEmail('*****@*****.**');
     $this->em->persist($customer);
     $this->em->flush();
     $customerId = $customer->getId();
     $this->em->clear();
     $customer = $this->em->find('Shopware\\Models\\Customer\\Customer', $customerId);
     $group = $this->em->getReference('Shopware\\Models\\Customer\\Group', $groupId);
     $customer->setGroup($group);
     $this->assertNotEmpty($customer->getId());
     $this->assertEquals($group, $customer->getGroup());
     $this->assertNotEmpty($customer->getGroup()->getId());
     $this->assertEquals($groupKey, $customer->getGroup()->getKey());
     return $customer;
 }