/** * Member オブジェクトを生成して返す. * * @param string $username. null の場合は, ランダムなユーザーIDが生成される. * @return \Eccube\Entity\Member */ public function createMember($username = null) { $faker = $this->getFaker(); $Member = new Member(); if (is_null($username)) { $username = $faker->word; } $Work = $this->app['orm.em']->getRepository('Eccube\\Entity\\Master\\Work')->find(1); $Authority = $this->app['eccube.repository.master.authority']->find(0); $Creator = $this->app['eccube.repository.member']->find(2); $salt = $this->app['eccube.repository.member']->createSalt(5); $Member->setPassword('password')->setLoginId($username)->setName($username)->setSalt($salt)->setWork($Work)->setAuthority($Authority)->setCreator($Creator); $password = $this->app['eccube.repository.member']->encryptPassword($Member); $Member->setPassword($password); $this->app['eccube.repository.member']->save($Member); return $Member; }
public function testSaveWithRankNull() { $Members = $this->app['eccube.repository.member']->findAll(); foreach ($Members as $Member) { $this->app['orm.em']->remove($Member); } $this->app['orm.em']->flush(); $Member = new Member(); $Member->setLoginId('member-100')->setPassword('password')->setSalt($this->app['eccube.repository.member']->createSalt(5))->setRank(100)->setDelFlg(Constant::DISABLED); $Member->setPassword($this->app['eccube.repository.member']->encryptPassword($Member)); $result = $this->app['eccube.repository.member']->save($Member); $this->assertTrue($result); $this->expected = 1; $this->actual = $Member->getRank(); $this->verify(); }
/** * {@inheritDoc} */ public function setPassword($password) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setPassword', array($password)); return parent::setPassword($password); }