diff --git a/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php b/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php index 814919e23c..6470f6c26f 100644 --- a/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php +++ b/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php @@ -16,4 +16,13 @@ abstract class PhabricatorTestDataGenerator { } } + + public function loadPhabrictorUserPHID() { + return $this->loadOneRandom("PhabricatorUser")->getPHID(); + } + + public function loadPhabrictorUser() { + return $this->loadOneRandom("PhabricatorUser"); + } + } diff --git a/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php b/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php index 6a04324a48..3245e19a76 100644 --- a/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php +++ b/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php @@ -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; diff --git a/src/applications/paste/lipsum/PhabricatorPasteTestDataGenerator.php b/src/applications/paste/lipsum/PhabricatorPasteTestDataGenerator.php index fe31a45834..dd99bb4811 100644 --- a/src/applications/paste/lipsum/PhabricatorPasteTestDataGenerator.php +++ b/src/applications/paste/lipsum/PhabricatorPasteTestDataGenerator.php @@ -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 diff --git a/src/applications/project/lipsum/PhabricatorProjectTestDataGenerator.php b/src/applications/project/lipsum/PhabricatorProjectTestDataGenerator.php index af726170a8..216d584df0 100644 --- a/src/applications/project/lipsum/PhabricatorProjectTestDataGenerator.php +++ b/src/applications/project/lipsum/PhabricatorProjectTestDataGenerator.php @@ -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);