Пример #1
0
 public function testSave()
 {
     $user = new User('email');
     $this->em->persist($user);
     $this->em->flush();
     $userToken = new UserToken($user, 'test_action', 'test_token');
     $this->assertAttributeEquals('test_action', 'action', $userToken);
     $this->assertAttributeEquals('test_token', 'token', $userToken);
     $this->assertAttributeEquals($user, 'user', $userToken);
     $this->em->persist($userToken);
     $this->em->flush();
     $this->em->clear();
     $tokens = $this->repository->findAll();
     $this->assertEquals(1, sizeof($tokens));
     $token = $this->repository->find(array('user' => $user->getId(), 'action' => 'test_action', 'token' => 'test_token'));
     $this->assertNotNull($token);
 }