/** * @return void */ public function testUpdateWithPasswordHashIgnored() { $data = $this->mockUserData(); $data2 = $this->mockUserData(); $user = $this->userFacade->addUser($data['firstName'], $data['lastName'], $data['username'], $data['password']); $user2 = clone $user; $user2->setPassword($data2['password']); $user2 = $this->userFacade->updateUser($user2); $this->assertNotEquals($user->getPassword(), $user2->getPassword()); $this->assertTrue($this->userFacade->isValidPassword($data2['password'], $user2->getPassword())); $user3 = clone $user2; $user3->setPassword($user->getPassword()); $user3 = $this->userFacade->updateUser($user3); $this->assertEquals($user3->getPassword(), $user2->getPassword()); $this->assertNotEquals($user3->getPassword(), $user->getPassword()); $this->assertNotEquals($user3->getPassword(), $data2['password']); $this->assertNotEquals($user3->getPassword(), $data['password']); }
/** * @param array $data * * @return \Generated\Shared\Transfer\UserTransfer */ private function mockAddUser(array $data) { return $this->userFacade->addUser($data['firstName'], $data['lastName'], $data['username'], $data['password']); }