mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +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:
parent
89747c0ea4
commit
0ca15f1f3b
4 changed files with 16 additions and 30 deletions
|
@ -16,4 +16,13 @@ abstract class PhabricatorTestDataGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function loadPhabrictorUserPHID() {
|
||||||
|
return $this->loadOneRandom("PhabricatorUser")->getPHID();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadPhabrictorUser() {
|
||||||
|
return $this->loadOneRandom("PhabricatorUser");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ final class PhabricatorManiphestTaskTestDataGenerator
|
||||||
extends PhabricatorTestDataGenerator {
|
extends PhabricatorTestDataGenerator {
|
||||||
|
|
||||||
public function generate() {
|
public function generate() {
|
||||||
$authorPHID = $this->loadAuthorPHID();
|
$authorPHID = $this->loadPhabrictorUserPHID();
|
||||||
$author = id(new PhabricatorUser())
|
$author = id(new PhabricatorUser())
|
||||||
->loadOneWhere('phid = %s', $authorPHID);
|
->loadOneWhere('phid = %s', $authorPHID);
|
||||||
$task = id(new ManiphestTask())
|
$task = id(new ManiphestTask())
|
||||||
|
@ -77,14 +77,6 @@ final class PhabricatorManiphestTaskTestDataGenerator
|
||||||
return $projects;
|
return $projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loadPhabrictorUserPHID() {
|
|
||||||
return $this->loadOneRandom("PhabricatorUser")->getPHID();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function loadAuthorPHID() {
|
|
||||||
return $this->loadPhabrictorUserPHID();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function loadOwnerPHID() {
|
public function loadOwnerPHID() {
|
||||||
if (rand(0, 3) == 0) {
|
if (rand(0, 3) == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -9,7 +9,7 @@ final class PhabricatorPasteTestDataGenerator
|
||||||
"PHP" => "php");
|
"PHP" => "php");
|
||||||
|
|
||||||
public function generate() {
|
public function generate() {
|
||||||
$authorphid = $this->loadAuthorPHID();
|
$authorphid = $this->loadPhabrictorUserPHID();
|
||||||
$language = $this->generateLanguage();
|
$language = $this->generateLanguage();
|
||||||
$content = $this->generateContent($language);
|
$content = $this->generateContent($language);
|
||||||
$title = $this->generateTitle($language);
|
$title = $this->generateTitle($language);
|
||||||
|
@ -45,14 +45,6 @@ final class PhabricatorPasteTestDataGenerator
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loadPhabrictorUserPHID() {
|
|
||||||
return id($this->loadOneRandom("PhabricatorUser"))->getPHID();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function loadAuthorPHID() {
|
|
||||||
return $this->loadPhabrictorUserPHID();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function generateTitle($language = null) {
|
public function generateTitle($language = null) {
|
||||||
$taskgen = new PhutilLipsumContextFreeGrammar();
|
$taskgen = new PhutilLipsumContextFreeGrammar();
|
||||||
// Remove Punctuation
|
// Remove Punctuation
|
||||||
|
|
|
@ -7,17 +7,18 @@ final class PhabricatorProjectTestDataGenerator
|
||||||
|
|
||||||
public function generate() {
|
public function generate() {
|
||||||
$title = $this->generateTitle();
|
$title = $this->generateTitle();
|
||||||
$author = $this->loadAuthorPHID();
|
$author = $this->loadPhabrictorUser();
|
||||||
|
$authorPHID = $author->getPHID();
|
||||||
$project = id(new PhabricatorProject())
|
$project = id(new PhabricatorProject())
|
||||||
->setName($title)
|
->setName($title)
|
||||||
->setAuthorPHID($author);
|
->setAuthorPHID($authorPHID);
|
||||||
|
|
||||||
$this->addTransaction(
|
$this->addTransaction(
|
||||||
PhabricatorProjectTransactionType::TYPE_NAME,
|
PhabricatorProjectTransactionType::TYPE_NAME,
|
||||||
$title);
|
$title);
|
||||||
$this->addTransaction(
|
$this->addTransaction(
|
||||||
PhabricatorProjectTransactionType::TYPE_MEMBERS,
|
PhabricatorProjectTransactionType::TYPE_MEMBERS,
|
||||||
$this->loadMembersWithAuthor($author));
|
$this->loadMembersWithAuthor($authorPHID));
|
||||||
$this->addTransaction(
|
$this->addTransaction(
|
||||||
PhabricatorProjectTransactionType::TYPE_STATUS,
|
PhabricatorProjectTransactionType::TYPE_STATUS,
|
||||||
$this->generateProjectStatus());
|
$this->generateProjectStatus());
|
||||||
|
@ -32,8 +33,7 @@ final class PhabricatorProjectTestDataGenerator
|
||||||
PhabricatorPolicies::POLICY_PUBLIC);
|
PhabricatorPolicies::POLICY_PUBLIC);
|
||||||
|
|
||||||
$editor = id(new PhabricatorProjectEditor($project))
|
$editor = id(new PhabricatorProjectEditor($project))
|
||||||
->setActor(id(new PhabricatorUser())
|
->setActor($author)
|
||||||
->loadOneWhere('phid = %s', $author))
|
|
||||||
->applyTransactions($this->xactions);
|
->applyTransactions($this->xactions);
|
||||||
|
|
||||||
$profile = id(new PhabricatorProjectProfile())
|
$profile = id(new PhabricatorProjectProfile())
|
||||||
|
@ -50,13 +50,6 @@ final class PhabricatorProjectTestDataGenerator
|
||||||
->setNewValue($value);
|
->setNewValue($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loadPhabrictorUserPHID() {
|
|
||||||
return $this->loadOneRandom("PhabricatorUser")->getPHID();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function loadAuthorPHID() {
|
|
||||||
return $this->loadPhabrictorUserPHID();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function loadMembersWithAuthor($author) {
|
public function loadMembersWithAuthor($author) {
|
||||||
$members = array($author);
|
$members = array($author);
|
||||||
|
|
Loading…
Reference in a new issue