1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 07:12:41 +01:00

Fixed Project Generation

Summary: Ref T2903

Test Plan: Projects still generating with @epriestley's recommendations

Reviewers: epriestley, AnhNhan

Reviewed By: AnhNhan

CC: aran, Korvin, AnhNhan

Maniphest Tasks: T2903

Differential Revision: https://secure.phabricator.com/D5800
This commit is contained in:
deedydas 2013-05-03 08:13:58 -07:00 committed by epriestley
parent 89747c0ea4
commit 0ca15f1f3b
4 changed files with 16 additions and 30 deletions

View file

@ -16,4 +16,13 @@ abstract class PhabricatorTestDataGenerator {
}
}
public function loadPhabrictorUserPHID() {
return $this->loadOneRandom("PhabricatorUser")->getPHID();
}
public function loadPhabrictorUser() {
return $this->loadOneRandom("PhabricatorUser");
}
}

View file

@ -4,7 +4,7 @@ final class PhabricatorManiphestTaskTestDataGenerator
extends PhabricatorTestDataGenerator {
public function generate() {
$authorPHID = $this->loadAuthorPHID();
$authorPHID = $this->loadPhabrictorUserPHID();
$author = id(new PhabricatorUser())
->loadOneWhere('phid = %s', $authorPHID);
$task = id(new ManiphestTask())
@ -77,14 +77,6 @@ final class PhabricatorManiphestTaskTestDataGenerator
return $projects;
}
private function loadPhabrictorUserPHID() {
return $this->loadOneRandom("PhabricatorUser")->getPHID();
}
public function loadAuthorPHID() {
return $this->loadPhabrictorUserPHID();
}
public function loadOwnerPHID() {
if (rand(0, 3) == 0) {
return null;

View file

@ -9,7 +9,7 @@ final class PhabricatorPasteTestDataGenerator
"PHP" => "php");
public function generate() {
$authorphid = $this->loadAuthorPHID();
$authorphid = $this->loadPhabrictorUserPHID();
$language = $this->generateLanguage();
$content = $this->generateContent($language);
$title = $this->generateTitle($language);
@ -45,14 +45,6 @@ final class PhabricatorPasteTestDataGenerator
return null;
}
private function loadPhabrictorUserPHID() {
return id($this->loadOneRandom("PhabricatorUser"))->getPHID();
}
public function loadAuthorPHID() {
return $this->loadPhabrictorUserPHID();
}
public function generateTitle($language = null) {
$taskgen = new PhutilLipsumContextFreeGrammar();
// Remove Punctuation

View file

@ -7,17 +7,18 @@ final class PhabricatorProjectTestDataGenerator
public function generate() {
$title = $this->generateTitle();
$author = $this->loadAuthorPHID();
$author = $this->loadPhabrictorUser();
$authorPHID = $author->getPHID();
$project = id(new PhabricatorProject())
->setName($title)
->setAuthorPHID($author);
->setAuthorPHID($authorPHID);
$this->addTransaction(
PhabricatorProjectTransactionType::TYPE_NAME,
$title);
$this->addTransaction(
PhabricatorProjectTransactionType::TYPE_MEMBERS,
$this->loadMembersWithAuthor($author));
$this->loadMembersWithAuthor($authorPHID));
$this->addTransaction(
PhabricatorProjectTransactionType::TYPE_STATUS,
$this->generateProjectStatus());
@ -32,8 +33,7 @@ final class PhabricatorProjectTestDataGenerator
PhabricatorPolicies::POLICY_PUBLIC);
$editor = id(new PhabricatorProjectEditor($project))
->setActor(id(new PhabricatorUser())
->loadOneWhere('phid = %s', $author))
->setActor($author)
->applyTransactions($this->xactions);
$profile = id(new PhabricatorProjectProfile())
@ -50,13 +50,6 @@ final class PhabricatorProjectTestDataGenerator
->setNewValue($value);
}
private function loadPhabrictorUserPHID() {
return $this->loadOneRandom("PhabricatorUser")->getPHID();
}
public function loadAuthorPHID() {
return $this->loadPhabrictorUserPHID();
}
public function loadMembersWithAuthor($author) {
$members = array($author);