From 814c28d39a81bf300296caf534038a6ddc7228d1 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 6 Mar 2017 19:58:08 +0000 Subject: [PATCH] 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 --- ...habricatorBadgesBadgeTestDataGenerator.php | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php b/src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php index 9b29ecb4f8..8d56e20fa3 100644 --- a/src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php +++ b/src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php @@ -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) {