Page MenuHomePhabricator

Add Merchant, Account conduit methods for Phortune
Changes PlannedPublic

Authored by chad on Jul 16 2017, 1:17 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 24, 12:53 AM
Unknown Object (File)
Sat, Apr 20, 7:55 AM
Unknown Object (File)
Tue, Apr 9, 4:53 PM
Unknown Object (File)
Fri, Apr 5, 12:35 AM
Unknown Object (File)
Mar 23 2024, 6:55 AM
Unknown Object (File)
Mar 15 2024, 4:03 PM
Unknown Object (File)
Feb 28 2024, 5:35 AM
Unknown Object (File)
Feb 9 2024, 7:53 AM
Subscribers

Details

Reviewers
epriestley
Summary

Adds in basic conduit methods to PhortuneAccount and PhortuneMerchant, builds out lipsum generators for both.

Test Plan

Visit conduit pages, run a test query. Run both lipsum generators.

Diff Detail

Repository
rP Phabricator
Branch
phortune-1 (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 17706
Build 23769: Run Core Tests
Build 23768: arc lint + arc unit

Event Timeline

  • add in test data generator
  • more better fake names
chad edited the test plan for this revision. (Show Details)
src/applications/lipsum/generator/PhabricatorTestDataGenerator.php
76

You can shuffle($admins); first as a low-budget way to pick one at random:

shuffle($admins);
return head($admins);

We do a fancier version of this above because "load everything, then pick one randomly" won't work well if there are 100,000 matching objects, but it should largely be fine here.

src/applications/phortune/lipsum/PhortuneAccountTestDataGenerator.php
23

This method sometimes returns a PHID (here) and sometimes an object (below). I think that actually works (the caller is OK with either), but presumably unintended?

27

What do you want to skip?

src/applications/phortune/lipsum/PhortuneMerchantTestDataGenerator.php
13

This isn't really true: the "Can Create Merchants" policy is configurable. It's possible for it to be set to "no one", or "anyone except admins", etc. This script will run with the install's configured policies.

Perhaps a better approach would be to provide a scoped policy override, like PhabricatorScopedEnv. The code would look something like this:

// For the purposes of generating lipsum merchants, allow any user to
// create merchants.
$override = id(new PhabricatorPhortuneApplication())
  ->newCapabilityOverride($can_create, POLICY_USERS);
...
unset($override);

Then you wouldn't need loadRandomAdmin(), either.

chad planned changes to this revision.Jul 19 2017, 5:50 PM