Example #1
0
 public function testUpdatePassword()
 {
     $admin = AdminQuery::create()->findOne();
     $adminEvent = new AdministratorUpdatePasswordEvent($admin);
     $adminEvent->setPassword('toto')->setDispatcher($this->getMock("Symfony\\Component\\EventDispatcher\\EventDispatcherInterface"));
     $actionAdmin = new Administrator();
     $actionAdmin->updatePassword($adminEvent);
     $updatedAdmin = $adminEvent->getAdmin();
     $this->assertInstanceOf("Thelia\\Model\\Admin", $updatedAdmin);
     $this->assertTrue(password_verify($adminEvent->getPassword(), $updatedAdmin->getPassword()));
 }
 public function testRenewPassword()
 {
     $admin = AdminQuery::create()->findOne();
     $admin->setPasswordRenewToken(null)->setEmail('*****@*****.**')->save();
     $adminEvent = new AdministratorEvent($admin);
     $actionAdmin = new Administrator($this->mailerFactory, $this->tokenProvider);
     $actionAdmin->createPassword($adminEvent);
     $updatedAdmin = $adminEvent->getAdministrator();
     $this->assertInstanceOf("Thelia\\Model\\Admin", $updatedAdmin);
     $this->assertNotEmpty($admin->getPasswordRenewToken());
 }