@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Conpherence - unit tests for T7670

Summary: Ref T7670. Add a few unit tests to make sure deleting everyone works. Also change remaining processRequest to handleRequest while in there.

Test Plan: `arc unit` passed

Reviewers: chad, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7670

Differential Revision: https://secure.phabricator.com/D12179

+69 -4
+26
src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php
··· 100 100 $conpherence->getRecentParticipantPHIDs()); 101 101 } 102 102 103 + public function testRoomParticipantDeletion() { 104 + $creator = $this->generateNewTestUser(); 105 + $friend_1 = $this->generateNewTestUser(); 106 + $friend_2 = $this->generateNewTestUser(); 107 + $friend_3 = $this->generateNewTestUser(); 108 + 109 + $participant_map = array( 110 + $creator->getPHID() => $creator, 111 + $friend_1->getPHID() => $friend_1, 112 + $friend_2->getPHID() => $friend_2, 113 + $friend_3->getPHID() => $friend_3, 114 + ); 115 + 116 + $conpherence = $this->createRoom( 117 + $creator, 118 + array_keys($participant_map)); 119 + 120 + foreach ($participant_map as $phid => $user) { 121 + $this->removeParticipants($user, $conpherence, array($phid)); 122 + unset($participant_map[$phid]); 123 + $this->assertEqual( 124 + count($participant_map), 125 + count($conpherence->getParticipants())); 126 + } 127 + } 128 + 103 129 private function createRoom( 104 130 PhabricatorUser $creator, 105 131 array $participant_phids) {
+15
src/applications/conpherence/__tests__/ConpherenceTestCase.php
··· 17 17 18 18 } 19 19 20 + protected function removeParticipants( 21 + PhabricatorUser $actor, 22 + ConpherenceThread $conpherence, 23 + array $participant_phids) { 24 + 25 + $xactions = array(id(new ConpherenceTransaction()) 26 + ->setTransactionType(ConpherenceTransactionType::TYPE_PARTICIPANTS) 27 + ->setNewValue(array('-' => $participant_phids)),); 28 + $editor = id(new ConpherenceEditor()) 29 + ->setActor($actor) 30 + ->setContentSource(PhabricatorContentSource::newConsoleSource()) 31 + ->applyTransactions($conpherence, $xactions); 32 + } 33 + 34 + 20 35 }
+26
src/applications/conpherence/__tests__/ConpherenceThreadTestCase.php
··· 86 86 $conpherence->getRecentParticipantPHIDs()); 87 87 } 88 88 89 + public function testThreadParticipantDeletion() { 90 + $creator = $this->generateNewTestUser(); 91 + $friend_1 = $this->generateNewTestUser(); 92 + $friend_2 = $this->generateNewTestUser(); 93 + $friend_3 = $this->generateNewTestUser(); 94 + 95 + $participant_map = array( 96 + $creator->getPHID() => $creator, 97 + $friend_1->getPHID() => $friend_1, 98 + $friend_2->getPHID() => $friend_2, 99 + $friend_3->getPHID() => $friend_3, 100 + ); 101 + 102 + $conpherence = $this->createThread( 103 + $creator, 104 + array_keys($participant_map)); 105 + 106 + foreach ($participant_map as $phid => $user) { 107 + $this->removeParticipants($user, $conpherence, array($phid)); 108 + unset($participant_map[$phid]); 109 + $this->assertEqual( 110 + count($participant_map), 111 + count($conpherence->getParticipants())); 112 + } 113 + } 114 + 89 115 private function createThread( 90 116 PhabricatorUser $creator, 91 117 array $participant_phids) {
+1 -2
src/applications/conpherence/controller/ConpherenceNewController.php
··· 2 2 3 3 final class ConpherenceNewController extends ConpherenceController { 4 4 5 - public function processRequest() { 6 - $request = $this->getRequest(); 5 + public function handleRequest(AphrontRequest $request) { 7 6 $user = $request->getUser(); 8 7 9 8 $title = pht('New Message');
+1 -2
src/applications/conpherence/controller/ConpherenceNotificationPanelController.php
··· 3 3 final class ConpherenceNotificationPanelController 4 4 extends ConpherenceController { 5 5 6 - public function processRequest() { 7 - $request = $this->getRequest(); 6 + public function handleRequest(AphrontRequest $request) { 8 7 $user = $request->getUser(); 9 8 $conpherences = array(); 10 9 $unread_status = ConpherenceParticipationStatus::BEHIND;