public function testValidLogin()
 {
     $em = $this->getEntityManager();
     $entity = new TestEntity();
     $entity->setUsername('username');
     $entity->setPassword('password');
     $em->persist($entity);
     $em->flush();
     $adapter = new DoctrineObject($em, 'DoctrineORMModuleTest\\Assets\\Entity\\Test');
     $adapter->setIdentityValue('username');
     $adapter->setCredentialValue('password');
     $result = $adapter->authenticate();
     $this->assertTrue($result->isValid());
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     for ($i = 0; $i < self::INSTANCES_COUNT; $i += 1) {
         $instance = new TestEntity();
         $instance->setUsername('username');
         $instance->setPassword('password');
         $manager->persist($instance);
     }
     for ($i = 0; $i < self::INSTANCES_COUNT; $i += 1) {
         $instance = new Category();
         $instance->setName('category');
         $manager->persist($instance);
     }
     for ($i = 0; $i < self::INSTANCES_COUNT; $i += 1) {
         $instance = new Country();
         $instance->setName('country');
         $manager->persist($instance);
     }
     $manager->flush();
 }