Skip to content

Commit 814c28d

Browse files
Chad Littlechad
authored andcommitted
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
1 parent b28da10 commit 814c28d

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function getGeneratorName() {
1212
public function generateObject() {
1313
$author = $this->loadRandomUser();
1414

15-
list($name, $description) = $this->newLoot();
15+
list($name, $description, $quality, $icon) = $this->newLoot();
1616

1717
$xactions = array();
1818

@@ -26,6 +26,16 @@ public function generateObject() {
2626
'value' => $description,
2727
);
2828

29+
$xactions[] = array(
30+
'type' => 'quality',
31+
'value' => (string)$quality,
32+
);
33+
34+
$xactions[] = array(
35+
'type' => 'icon',
36+
'value' => $icon,
37+
);
38+
2939
$params = array(
3040
'transactions' => $xactions,
3141
);
@@ -58,7 +68,17 @@ private function newLoot() {
5868

5969
$drop = preg_replace($effect_pattern, '', $drop);
6070

61-
return array($drop, $description);
71+
$quality_map = PhabricatorBadgesQuality::getQualityMap();
72+
shuffle($quality_map);
73+
$quality = head($quality_map);
74+
$rarity = $quality['rarity'];
75+
76+
$icon_map = id(new PhabricatorBadgesIconSet())->getIcons();
77+
shuffle($icon_map);
78+
$icon_map = head($icon_map);
79+
$icon = $icon_map->getKey();
80+
81+
return array($drop, $description, $rarity, $icon);
6282
}
6383

6484
public function rollDropValue($matches) {

0 commit comments

Comments
 (0)