Changeset View
Changeset View
Standalone View
Standalone View
src/applications/lipsum/generator/PhabricatorTestDataGenerator.php
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | protected function newTransaction($type, $value, $metadata = array()) { | ||||
foreach ($metadata as $key => $value) { | foreach ($metadata as $key => $value) { | ||||
$xaction->setMetadataValue($key, $value); | $xaction->setMetadataValue($key, $value); | ||||
} | } | ||||
return $xaction; | return $xaction; | ||||
} | } | ||||
public function loadOneRandom($classname) { | public function loadOneRandom($classname) { | ||||
try { | try { | ||||
return newv($classname, array()) | return newv($classname, array()) | ||||
->loadOneWhere('1 = 1 ORDER BY RAND() LIMIT 1'); | ->loadOneWhere('1 = 1 ORDER BY RAND() LIMIT 1'); | ||||
} catch (PhutilMissingSymbolException $ex) { | } catch (PhutilMissingSymbolException $ex) { | ||||
throw new PhutilMissingSymbolException( | throw new PhutilMissingSymbolException( | ||||
$classname, | $classname, | ||||
pht('class'), | pht('class'), | ||||
pht( | pht( | ||||
'Unable to load symbol %s: this class does not exist.', | 'Unable to load symbol %s: this class does not exist.', | ||||
$classname)); | $classname)); | ||||
} | } | ||||
} | } | ||||
public function loadPhabrictorUserPHID() { | public function loadPhabricatorUserPHID() { | ||||
return $this->loadOneRandom('PhabricatorUser')->getPHID(); | return $this->loadOneRandom('PhabricatorUser')->getPHID(); | ||||
} | } | ||||
public function loadPhabrictorUser() { | public function loadPhabricatorUser() { | ||||
return $this->loadOneRandom('PhabricatorUser'); | return $this->loadOneRandom('PhabricatorUser'); | ||||
} | } | ||||
} | } |