public function testUpdate() { $admin = AdminQuery::create()->findOne(); $login = '******' . uniqid(); $locale = LangQuery::create()->findOne()->getLocale(); $adminEvent = new AdministratorEvent(); $adminEvent->setId($admin->getId())->setFirstname('thelia_update')->setLastname('thelia_update')->setLogin($login)->setPassword('azertyuiop')->setLocale($locale)->setDispatcher($this->getMock("Symfony\\Component\\EventDispatcher\\EventDispatcherInterface")); $actionAdmin = new Administrator(); $actionAdmin->update($adminEvent); $updatedAdmin = $adminEvent->getAdministrator(); $this->assertInstanceOf("Thelia\\Model\\Admin", $updatedAdmin); $this->assertFalse($updatedAdmin->isNew()); $this->assertEquals($adminEvent->getFirstname(), $updatedAdmin->getFirstname()); $this->assertEquals($adminEvent->getLastname(), $updatedAdmin->getLastname()); $this->assertEquals($adminEvent->getLogin(), $updatedAdmin->getLogin()); $this->assertEquals($adminEvent->getLocale(), $updatedAdmin->getLocale()); $this->assertEquals($adminEvent->getProfile(), $updatedAdmin->getProfileId()); $this->assertTrue(password_verify($adminEvent->getPassword(), $updatedAdmin->getPassword())); }
public function testUpdate() { $admin = AdminQuery::create()->findOne(); $login = '******' . uniqid(); $locale = LangQuery::create()->findOne()->getLocale(); $adminEvent = new AdministratorEvent(); $adminEvent->setId($admin->getId())->setFirstname('thelia_update')->setLastname('thelia_update')->setLogin($login)->setPassword('azertyuiop')->setLocale($locale)->setEmail(uniqid() . '@example.com')->setDispatcher($this->getMockEventDispatcher()); $actionAdmin = new Administrator($this->mailerFactory, $this->tokenProvider); $actionAdmin->update($adminEvent, null, $this->getMockEventDispatcher()); $updatedAdmin = $adminEvent->getAdministrator(); $this->assertInstanceOf("Thelia\\Model\\Admin", $updatedAdmin); $this->assertFalse($updatedAdmin->isNew()); $this->assertEquals($adminEvent->getFirstname(), $updatedAdmin->getFirstname()); $this->assertEquals($adminEvent->getLastname(), $updatedAdmin->getLastname()); $this->assertEquals($adminEvent->getLogin(), $updatedAdmin->getLogin()); $this->assertEquals($adminEvent->getLocale(), $updatedAdmin->getLocale()); $this->assertEquals($adminEvent->getProfile(), $updatedAdmin->getProfileId()); $this->assertTrue(password_verify($adminEvent->getPassword(), $updatedAdmin->getPassword())); }