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

Add quality and icon to Badge Lipsum generator

Summary: This just adds a few more dimensions to the generator.

Test Plan: run `bin/lipsum generate badges`, verify new icons and quality work.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17474
This commit is contained in:
Chad Little 2017-03-06 19:58:08 +00:00 committed by chad
parent b28da10336
commit 814c28d39a

View file

@ -12,7 +12,7 @@ final class PhabricatorBadgesBadgeTestDataGenerator
public function generateObject() {
$author = $this->loadRandomUser();
list($name, $description) = $this->newLoot();
list($name, $description, $quality, $icon) = $this->newLoot();
$xactions = array();
@ -26,6 +26,16 @@ final class PhabricatorBadgesBadgeTestDataGenerator
'value' => $description,
);
$xactions[] = array(
'type' => 'quality',
'value' => (string)$quality,
);
$xactions[] = array(
'type' => 'icon',
'value' => $icon,
);
$params = array(
'transactions' => $xactions,
);
@ -58,7 +68,17 @@ final class PhabricatorBadgesBadgeTestDataGenerator
$drop = preg_replace($effect_pattern, '', $drop);
return array($drop, $description);
$quality_map = PhabricatorBadgesQuality::getQualityMap();
shuffle($quality_map);
$quality = head($quality_map);
$rarity = $quality['rarity'];
$icon_map = id(new PhabricatorBadgesIconSet())->getIcons();
shuffle($icon_map);
$icon_map = head($icon_map);
$icon = $icon_map->getKey();
return array($drop, $description, $rarity, $icon);
}
public function rollDropValue($matches) {