Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function getUser()
 {
     if (null === $this->customer) {
         return null;
     }
     return $this->customer->getUser();
 }
 function it_does_nothing_on_customer_update_when_no_user_associated(OnFlushEventArgs $onFlushEventArgs, EntityManager $entityManager, UnitOfWork $unitOfWork, CustomerInterface $customer)
 {
     $onFlushEventArgs->getEntityManager()->willReturn($entityManager);
     $entityManager->getUnitOfWork()->willReturn($unitOfWork);
     $unitOfWork->getScheduledEntityInsertions()->willReturn([]);
     $unitOfWork->getScheduledEntityUpdates()->willReturn([$customer]);
     $customer->getUser()->willReturn(null);
     $customer->getEmail()->willReturn('*****@*****.**');
     $unitOfWork->recomputeSingleEntityChangeSet(Argument::cetera())->shouldNotBeCalled();
     $this->onFlush($onFlushEventArgs);
 }
 /**
  * @Then the customer :customer should have an account created
  * @Then /^(this customer) should have an account created$/
  */
 public function theyShouldHaveAnAccountCreated(CustomerInterface $customer)
 {
     Assert::notNull($customer->getUser()->getPassword(), 'Customer should have an account, but they do not.');
 }