mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-20 13:52:40 +01:00
lipsum - tighten up some test data generation
Summary: maniphest tasks were fataling with priority 0 before making sure to add the return null if new object trick to the maniphest pro editor. pholio had a problem where if you had no jpegs you were walking off array_rand. tighten the math and then just return a built-in if no uploaded user images could be found. Fixes T3889. Test Plan: bin/lipsum generate for a few minutes and no errors Reviewers: epriestley Reviewed By: epriestley CC: Korvin, aran Maniphest Tasks: T3889 Differential Revision: https://secure.phabricator.com/D7222
This commit is contained in:
parent
ee4bdb501b
commit
c35b93d9b6
4 changed files with 14 additions and 1 deletions
|
@ -28,6 +28,9 @@ final class ManiphestTransactionEditorPro
|
|||
|
||||
switch ($xaction->getTransactionType()) {
|
||||
case ManiphestTransaction::TYPE_PRIORITY:
|
||||
if ($this->getIsNewObject()) {
|
||||
return null;
|
||||
}
|
||||
return (int)$object->getPriority();
|
||||
case ManiphestTransaction::TYPE_STATUS:
|
||||
if ($this->getIsNewObject()) {
|
||||
|
|
|
@ -49,7 +49,7 @@ final class PhabricatorManiphestTaskTestDataGenerator
|
|||
->setContinueOnNoEffect(true)
|
||||
->setContinueOnMissingFields(true)
|
||||
->applyTransactions($task, $transactions);
|
||||
return $task->save();
|
||||
return $task;
|
||||
}
|
||||
|
||||
public function getCCPHIDs() {
|
||||
|
|
|
@ -78,6 +78,7 @@ final class ManiphestTransaction
|
|||
switch ($this->getTransactionType()) {
|
||||
case self::TYPE_TITLE:
|
||||
case self::TYPE_DESCRIPTION:
|
||||
case self::TYPE_PRIORITY:
|
||||
if ($this->getOldValue() === null) {
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -92,9 +92,18 @@ final class PhabricatorPholioMockTestDataGenerator
|
|||
->loadAllWhere("mimeType = %s", "image/jpeg");
|
||||
$rand_images = array();
|
||||
$quantity = rand(2, 10);
|
||||
$quantity = min($quantity, count($images));
|
||||
foreach (array_rand($images, $quantity) as $random) {
|
||||
$rand_images[] = $images[$random]->getPHID();
|
||||
}
|
||||
// this means you don't have any jpegs yet. we'll
|
||||
// just use a builtin image
|
||||
if (empty($rand_images)) {
|
||||
$default = PhabricatorFile::loadBuiltin(
|
||||
PhabricatorUser::getOmnipotentUser(),
|
||||
'profile.png');
|
||||
$rand_images[] = $default->getPHID();
|
||||
}
|
||||
return $rand_images;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue