Beispiel #1
0
 public function testCreate()
 {
     $userRole = $this->dummyData->getUserRole();
     $userStatus = $this->dummyData->getUserStatusType();
     $order = $this->dummyData->getOrder();
     $cart = $this->dummyData->getCart();
     $user = new User();
     $user->setExternalId('5');
     $user->setStatus($userStatus);
     $user->setEmail('*****@*****.**');
     $user->setPassword('password1');
     $user->setFirstName('John');
     $user->setLastName('Doe');
     $user->addUserRole($userRole);
     $user->addOrder($order);
     $user->setCart($cart);
     $userLogin = $this->dummyData->getUserLogin($user);
     $userToken = $this->dummyData->getUserToken($user);
     $this->assertEntityValid($user);
     $this->assertSame($userStatus, $user->getStatus());
     $this->assertSame('5', $user->getExternalId());
     $this->assertSame('*****@*****.**', $user->getEmail());
     $this->assertSame('John', $user->getFirstName());
     $this->assertSame('Doe', $user->getLastName());
     $this->assertSame(1, $user->getTotalLogins());
     $this->assertSame($userRole, $user->getUserRoles()[0]);
     $this->assertSame($userToken, $user->getUserTokens()[0]);
     $this->assertSame($userLogin, $user->getUserLogins()[0]);
     $this->assertSame($order, $user->getOrders()[0]);
     $this->assertSame($cart, $user->getCart());
     $this->assertTrue($user->getLastLogin()->getTimestamp() > 0);
 }
Beispiel #2
0
 public function setUser(User $user)
 {
     $user->setCart($this);
     $this->user = $user;
 }