Differential D14883 Diff 35976 src/applications/project/lipsum/PhabricatorProjectTestDataGenerator.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/lipsum/PhabricatorProjectTestDataGenerator.php
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | $editor = id(new PhabricatorProjectTransactionEditor()) | ||||
->setActor($author) | ->setActor($author) | ||||
->setContentSource($this->getLipsumContentSource()) | ->setContentSource($this->getLipsumContentSource()) | ||||
->setContinueOnNoEffect(true) | ->setContinueOnNoEffect(true) | ||||
->applyTransactions($project, $xactions); | ->applyTransactions($project, $xactions); | ||||
return $project; | return $project; | ||||
} | } | ||||
private function newTransaction($type, $value, $metadata = array()) { | protected function newEmptyTransaction() { | ||||
$xaction = id(new PhabricatorProjectTransaction()) | return new PhabricatorProjectTransaction(); | ||||
->setTransactionType($type) | |||||
->setNewValue($value); | |||||
foreach ($metadata as $key => $value) { | |||||
$xaction->setMetadataValue($key, $value); | |||||
} | |||||
return $xaction; | |||||
} | } | ||||
public function newProjectTitle() { | public function newProjectTitle() { | ||||
return id(new PhabricatorProjectNameContextFreeGrammar()) | return id(new PhabricatorProjectNameContextFreeGrammar()) | ||||
->generate(); | ->generate(); | ||||
} | } | ||||
public function newProjectStatus() { | public function newProjectStatus() { | ||||
if ($this->roll(1, 20) > 5) { | if ($this->roll(1, 20) > 5) { | ||||
return PhabricatorProjectStatus::STATUS_ACTIVE; | return PhabricatorProjectStatus::STATUS_ACTIVE; | ||||
} else { | } else { | ||||
return PhabricatorProjectStatus::STATUS_ARCHIVED; | return PhabricatorProjectStatus::STATUS_ARCHIVED; | ||||
} | } | ||||
} | } | ||||
} | } |