/** * @param type $name * @param \User $user * @return \Project * @throws \ExistingProjectException */ public function createProject($values, \User $user) { $project = new \Project(); $key = $this->keyGenerator->generateKey(); $name = Strings::webalize(Strings::lower(Strings::toAscii($values->caption))); $name = str_replace('-', '_', $name); $project->setCaption($values->caption)->setName($name)->setSourceLanguage($values->sourceLang)->setLink($values->link)->setKey($key); $project->setOwner($user); $this->dm->persist($project); $this->dm->flush(); return $project; }
public function testGenerateKey() { $key = $this->keyGenerator->generateKey(); $this->assertRegexp('/^[0-9A-Za-z]{40}$/', $key); }