3 abstract class ConpherenceTestCase
extends PhabricatorTestCase
{
5 protected function addParticipants(
6 PhabricatorUser
$actor,
7 ConpherenceThread
$conpherence,
8 array $participant_phids) {
11 id(new ConpherenceTransaction())
13 ConpherenceThreadParticipantsTransaction
::TRANSACTIONTYPE
)
14 ->setNewValue(array('+' => $participant_phids)),
16 $editor = id(new ConpherenceEditor())
18 ->setContentSource($this->newContentSource())
19 ->applyTransactions($conpherence, $xactions);
23 protected function removeParticipants(
24 PhabricatorUser
$actor,
25 ConpherenceThread
$conpherence,
26 array $participant_phids) {
29 id(new ConpherenceTransaction())
31 ConpherenceThreadParticipantsTransaction
::TRANSACTIONTYPE
)
32 ->setNewValue(array('-' => $participant_phids)),
34 $editor = id(new ConpherenceEditor())
36 ->setContentSource($this->newContentSource())
37 ->applyTransactions($conpherence, $xactions);
40 protected function addMessageWithFile(
41 PhabricatorUser
$actor,
42 ConpherenceThread
$conpherence) {
44 $file = $this->generateTestFile($actor);
45 $message = Filesystem
::readRandomCharacters(64).
46 sprintf(' {%s} ', $file->getMonogram());
48 $editor = id(new ConpherenceEditor())
50 ->setContentSource($this->newContentSource());
52 $xactions = $editor->generateTransactionsFromText(
57 return $editor->applyTransactions($conpherence, $xactions);
60 private function generateTestFile(PhabricatorUser
$actor) {
61 $engine = new PhabricatorTestStorageEngine();
62 $data = Filesystem
::readRandomCharacters(64);
65 'name' => 'test.'.$actor->getPHID(),
66 'viewPolicy' => $actor->getPHID(),
67 'authorPHID' => $actor->getPHID(),
68 'storageEngines' => array(
73 $file = PhabricatorFile
::newFromFileData($data, $params);