@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.

Added some additional assertion methods.

Summary:
There are quite a few tests in Arcanist, libphutil and Phabricator that do something similar to `$this->assertEqual(false, ...)` or `$this->assertEqual(true, ...)`.

This is unnecessarily verbose and it would be cleaner if we had `assertFalse` and `assertTrue` methods.

Test Plan: I contemplated adding a unit test for the `getCallerInfo` method but wasn't sure if it was required / where it should live.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

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

authored by

Joshua Spence and committed by
epriestley
e11adc4a 08040ae9

+112 -190
+2 -4
src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php
··· 256 256 $result = $ex; 257 257 } 258 258 259 - $this->assertEqual( 260 - true, 259 + $this->assertTrue( 261 260 ($result === null), 262 261 "Expect user '{$uname}' to be allowed access to '{$label}'."); 263 262 } ··· 272 271 $result = $ex; 273 272 } 274 273 275 - $this->assertEqual( 276 - false, 274 + $this->assertFalse( 277 275 ($result === null), 278 276 "Expect user '{$uname}' to be denied access to '{$label}'."); 279 277 }
+2 -3
src/applications/conduit/call/__tests__/ConduitCallTestCase.php
··· 7 7 $call->setForceLocal(true); 8 8 $result = $call->execute(); 9 9 10 - $this->assertEqual(false, empty($result)); 10 + $this->assertFalse(empty($result)); 11 11 } 12 12 13 13 public function testConduitAuth() { ··· 21 21 $caught = $ex; 22 22 } 23 23 24 - $this->assertEqual( 25 - true, 24 + $this->assertTrue( 26 25 ($caught instanceof ConduitException), 27 26 "user.whoami should require authentication"); 28 27 }
+2 -3
src/applications/diffusion/ssh/__tests__/DiffusionSSHMercurialWireTestCase.php
··· 11 11 $raw = explode("\n~~~~~~~~~~\n", $raw, 2); 12 12 $this->assertEqual(2, count($raw)); 13 13 $expect = json_decode($raw[1], true); 14 - $this->assertEqual(true, is_array($expect), $file); 14 + $this->assertTrue(is_array($expect), $file); 15 15 16 16 $this->assertParserResult($expect, $raw[0], $file); 17 17 } ··· 49 49 $caught = $ex; 50 50 } 51 51 52 - $this->assertEqual( 53 - true, 52 + $this->assertTrue( 54 53 ($caught instanceof Exception), 55 54 "No extra messages for '{$file}'."); 56 55 }
+2 -2
src/applications/files/storage/__tests__/PhabricatorFileTestCase.php
··· 56 56 $first_handle = $first_file->getStorageHandle(); 57 57 $second_handle = $second_file->getStorageHandle(); 58 58 59 - $this->assertEqual(true, ($first_handle != $second_handle)); 59 + $this->assertTrue($first_handle != $second_handle); 60 60 } 61 61 62 62 ··· 107 107 $caught = $ex; 108 108 } 109 109 110 - $this->assertEqual(true, $caught instanceof Exception); 110 + $this->assertTrue($caught instanceof Exception); 111 111 } 112 112 113 113 public function testFileStorageDeleteSharedHandle() {
+2 -4
src/applications/metamta/receiver/__tests__/PhabricatorMailReceiverTestCase.php
··· 16 16 ); 17 17 18 18 foreach ($same as $address) { 19 - $this->assertEqual( 20 - true, 19 + $this->assertTrue( 21 20 PhabricatorMailReceiver::matchAddresses($base, $address), 22 21 "Address {$address}"); 23 22 } ··· 32 31 ); 33 32 34 33 foreach ($diff as $address) { 35 - $this->assertEqual( 36 - false, 34 + $this->assertFalse( 37 35 PhabricatorMailReceiver::matchAddresses($base, $address), 38 36 "Address: {$address}"); 39 37 }
+8 -16
src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php
··· 59 59 $mail = new PhabricatorMetaMTAMail(); 60 60 $mail->addTos(array($phid)); 61 61 62 - $this->assertEqual( 63 - true, 62 + $this->assertTrue( 64 63 in_array($phid, $mail->buildRecipientList()), 65 64 '"To" is a recipient.'); 66 65 ··· 68 67 // Test that the "No Self Mail" preference works correctly. 69 68 $mail->setFrom($phid); 70 69 71 - $this->assertEqual( 72 - true, 70 + $this->assertTrue( 73 71 in_array($phid, $mail->buildRecipientList()), 74 72 '"From" does not exclude recipients by default.'); 75 73 ··· 78 76 true); 79 77 $prefs->save(); 80 78 81 - $this->assertEqual( 82 - false, 79 + $this->assertFalse( 83 80 in_array($phid, $mail->buildRecipientList()), 84 81 '"From" excludes recipients with no-self-mail set.'); 85 82 ··· 87 84 PhabricatorUserPreferences::PREFERENCE_NO_SELF_MAIL); 88 85 $prefs->save(); 89 86 90 - $this->assertEqual( 91 - true, 87 + $this->assertTrue( 92 88 in_array($phid, $mail->buildRecipientList()), 93 89 '"From" does not exclude recipients by default.'); 94 90 ··· 96 92 // Test that explicit exclusion works correctly. 97 93 $mail->setExcludeMailRecipientPHIDs(array($phid)); 98 94 99 - $this->assertEqual( 100 - false, 95 + $this->assertFalse( 101 96 in_array($phid, $mail->buildRecipientList()), 102 97 'Explicit exclude excludes recipients.'); 103 98 ··· 114 109 115 110 $mail->setMailTags(array('test-tag')); 116 111 117 - $this->assertEqual( 118 - false, 112 + $this->assertFalse( 119 113 in_array($phid, $mail->buildRecipientList()), 120 114 'Tag preference excludes recipients.'); 121 115 122 116 $prefs->unsetPreference(PhabricatorUserPreferences::PREFERENCE_MAILTAGS); 123 117 $prefs->save(); 124 118 125 - $this->assertEqual( 126 - true, 119 + $this->assertTrue( 127 120 in_array($phid, $mail->buildRecipientList()), 128 121 'Recipients restored after tag preference removed.'); 129 122 } ··· 166 159 $case = "<message-id = ".($supports_message_id ? 'Y' : 'N').", ". 167 160 "first = ".($is_first_mail ? 'Y' : 'N').">"; 168 161 169 - $this->assertEqual( 170 - true, 162 + $this->assertTrue( 171 163 isset($dict['Thread-Index']), 172 164 "Expect Thread-Index header for case {$case}."); 173 165 $this->assertEqual(
+3 -3
src/applications/people/editor/__tests__/PhabricatorUserEditorTestCase.php
··· 16 16 'PhabricatorUserEditorTestCaseOK', 17 17 'PhabricatorUserEditorTestCase@example.com'); 18 18 19 - $this->assertEqual(true, true); 19 + $this->assertTrue(true); 20 20 } 21 21 22 22 public function testRegistrationEmailInvalid() { ··· 34 34 $caught = $ex; 35 35 } 36 36 37 - $this->assertEqual(true, ($caught instanceof Exception)); 37 + $this->assertTrue($caught instanceof Exception); 38 38 } 39 39 40 40 public function testRegistrationEmailDomain() { ··· 50 50 $caught = $ex; 51 51 } 52 52 53 - $this->assertEqual(true, ($caught instanceof Exception)); 53 + $this->assertTrue($caught instanceof Exception); 54 54 } 55 55 56 56 private function registerUser($username, $email) {
+3 -3
src/applications/phid/query/__tests__/PhabricatorObjectListQueryTestCase.php
··· 36 36 } catch (Exception $ex) { 37 37 $caught = $ex; 38 38 } 39 - $this->assertEqual(true, ($caught instanceof Exception)); 39 + $this->assertTrue($caught instanceof Exception); 40 40 41 41 42 42 // Expect failure when loading an invalid object. ··· 46 46 } catch (Exception $ex) { 47 47 $caught = $ex; 48 48 } 49 - $this->assertEqual(true, ($caught instanceof Exception)); 49 + $this->assertTrue($caught instanceof Exception); 50 50 51 51 52 52 // Expect failure when loading ANY invalid object, by default. ··· 56 56 } catch (Exception $ex) { 57 57 $caught = $ex; 58 58 } 59 - $this->assertEqual(true, ($caught instanceof Exception)); 59 + $this->assertTrue($caught instanceof Exception); 60 60 61 61 62 62 // With partial results, this should load the valid user.
+1 -1
src/applications/phortune/currency/__tests__/PhortuneCurrencyTestCase.php
··· 86 86 } catch (Exception $ex) { 87 87 $caught = $ex; 88 88 } 89 - $this->assertEqual(true, ($caught instanceof Exception), "{$input}"); 89 + $this->assertTrue($caught instanceof Exception, "{$input}"); 90 90 } 91 91 } 92 92
+2 -4
src/applications/phortune/provider/__tests__/PhortunePaymentProviderTestCase.php
··· 22 22 $caught = $ex; 23 23 } 24 24 25 - $this->assertEqual( 26 - true, 25 + $this->assertTrue( 27 26 ($caught instanceof PhortuneNoPaymentProviderException), 28 27 'No provider should accept hugs; they are not a currency.'); 29 28 } ··· 42 41 $caught = $ex; 43 42 } 44 43 45 - $this->assertEqual( 46 - true, 44 + $this->assertTrue( 47 45 ($caught instanceof PhortuneMultiplePaymentProvidersException), 48 46 'Expect exception when more than one provider handles a payment method.'); 49 47 }
+1 -1
src/applications/phriction/storage/__tests__/PhrictionDocumentTestCase.php
··· 41 41 } 42 42 43 43 if ($expect === null) { 44 - $this->assertEqual(true, (bool)$ex, "Slug '{$slug}' is invalid."); 44 + $this->assertTrue((bool)$ex, "Slug '{$slug}' is invalid."); 45 45 } else { 46 46 $this->assertEqual($expect, $result, "Slug '{$slug}' identifier."); 47 47 }
+6 -6
src/applications/policy/__tests__/PhabricatorPolicyDataTestCase.php
··· 57 57 $task, 58 58 PhabricatorPolicyCapability::CAN_VIEW); 59 59 60 - $this->assertEqual(true, $can_a_view); 60 + $this->assertTrue($can_a_view); 61 61 62 62 $can_b_view = PhabricatorPolicyFilter::hasCapability( 63 63 $user_b, 64 64 $task, 65 65 PhabricatorPolicyCapability::CAN_VIEW); 66 66 67 - $this->assertEqual(false, $can_b_view); 67 + $this->assertFalse($can_b_view); 68 68 } 69 69 70 70 public function testCustomPolicyRuleAdministrators() { ··· 93 93 $task, 94 94 PhabricatorPolicyCapability::CAN_VIEW); 95 95 96 - $this->assertEqual(true, $can_a_view); 96 + $this->assertTrue($can_a_view); 97 97 98 98 $can_b_view = PhabricatorPolicyFilter::hasCapability( 99 99 $user_b, 100 100 $task, 101 101 PhabricatorPolicyCapability::CAN_VIEW); 102 102 103 - $this->assertEqual(false, $can_b_view); 103 + $this->assertFalse($can_b_view); 104 104 } 105 105 106 106 public function testCustomPolicyRuleLunarPhase() { ··· 128 128 $user_a, 129 129 $task, 130 130 PhabricatorPolicyCapability::CAN_VIEW); 131 - $this->assertEqual(true, $can_a_view); 131 + $this->assertTrue($can_a_view); 132 132 133 133 unset($time_a); 134 134 ··· 139 139 $user_a, 140 140 $task, 141 141 PhabricatorPolicyCapability::CAN_VIEW); 142 - $this->assertEqual(false, $can_a_view); 142 + $this->assertFalse($can_a_view); 143 143 144 144 unset($time_b); 145 145 }
+2 -4
src/applications/policy/__tests__/PhabricatorPolicyTestCase.php
··· 220 220 if (!$class) { 221 221 continue; 222 222 } 223 - $this->assertEqual( 224 - true, 223 + $this->assertTrue( 225 224 (bool)PhabricatorApplication::getByClass($class), 226 225 "Application class '{$class}' for query '{$qclass}'"); 227 226 } ··· 284 283 $result, 285 284 "{$description} with user {$spec} should succeed."); 286 285 } else { 287 - $this->assertEqual( 288 - true, 286 + $this->assertTrue( 289 287 $caught instanceof PhabricatorPolicyException, 290 288 "{$description} with user {$spec} should fail."); 291 289 }
+20 -39
src/applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php
··· 28 28 $can_view = PhabricatorPolicyCapability::CAN_VIEW; 29 29 30 30 // When the view policy is set to "users", any user can see the project. 31 - $this->assertEqual( 32 - true, 33 - (bool)$this->refreshProject($proj, $user)); 34 - $this->assertEqual( 35 - true, 36 - (bool)$this->refreshProject($proj, $user2)); 31 + $this->assertTrue((bool)$this->refreshProject($proj, $user)); 32 + $this->assertTrue((bool)$this->refreshProject($proj, $user2)); 37 33 38 34 39 35 // When the view policy is set to "no one", members can still see the ··· 41 37 $proj->setViewPolicy(PhabricatorPolicies::POLICY_NOONE); 42 38 $proj->save(); 43 39 44 - $this->assertEqual( 45 - true, 46 - (bool)$this->refreshProject($proj, $user)); 47 - $this->assertEqual( 48 - false, 49 - (bool)$this->refreshProject($proj, $user2)); 40 + $this->assertTrue((bool)$this->refreshProject($proj, $user)); 41 + $this->assertFalse((bool)$this->refreshProject($proj, $user2)); 50 42 } 51 43 52 44 public function testEditProject() { ··· 66 58 $proj->setEditPolicy(PhabricatorPolicies::POLICY_USER); 67 59 $proj->save(); 68 60 69 - $this->assertEqual( 70 - true, 71 - $this->attemptProjectEdit($proj, $user)); 61 + $this->assertTrue($this->attemptProjectEdit($proj, $user)); 72 62 73 63 74 64 // When edit policy is set to "no one", no one can edit. ··· 81 71 } catch (Exception $ex) { 82 72 $caught = $ex; 83 73 } 84 - $this->assertEqual(true, ($caught instanceof Exception)); 74 + $this->assertTrue($caught instanceof Exception); 85 75 } 86 76 87 77 private function attemptProjectEdit( ··· 113 103 $proj->save(); 114 104 115 105 $proj = $this->refreshProject($proj, $user, true); 116 - $this->assertEqual( 117 - true, 106 + $this->assertTrue( 118 107 (bool)$proj, 119 108 'Assumption that projects are default visible to any user when created.'); 120 109 121 - $this->assertEqual( 122 - false, 110 + $this->assertFalse( 123 111 $proj->isUserMember($user->getPHID()), 124 112 'Arbitrary user not member of project.'); 125 113 ··· 127 115 $this->joinProject($proj, $user); 128 116 129 117 $proj = $this->refreshProject($proj, $user, true); 130 - $this->assertEqual(true, (bool)$proj); 118 + $this->assertTrue((bool)$proj); 131 119 132 - $this->assertEqual( 133 - true, 120 + $this->assertTrue( 134 121 $proj->isUserMember($user->getPHID()), 135 122 'Join works.'); 136 123 ··· 139 126 $this->joinProject($proj, $user); 140 127 141 128 $proj = $this->refreshProject($proj, $user, true); 142 - $this->assertEqual(true, (bool)$proj); 129 + $this->assertTrue((bool)$proj); 143 130 144 - $this->assertEqual( 145 - true, 131 + $this->assertTrue( 146 132 $proj->isUserMember($user->getPHID()), 147 133 'Joining an already-joined project is a no-op.'); 148 134 ··· 151 137 $this->leaveProject($proj, $user); 152 138 153 139 $proj = $this->refreshProject($proj, $user, true); 154 - $this->assertEqual(true, (bool)$proj); 140 + $this->assertTrue((bool)$proj); 155 141 156 - $this->assertEqual( 157 - false, 142 + $this->assertFalse( 158 143 $proj->isUserMember($user->getPHID()), 159 144 'Leave works.'); 160 145 ··· 163 148 $this->leaveProject($proj, $user); 164 149 165 150 $proj = $this->refreshProject($proj, $user, true); 166 - $this->assertEqual(true, (bool)$proj); 151 + $this->assertTrue((bool)$proj); 167 152 168 - $this->assertEqual( 169 - false, 153 + $this->assertFalse( 170 154 $proj->isUserMember($user->getPHID()), 171 155 'Leaving an already-left project is a no-op.'); 172 156 ··· 183 167 } catch (Exception $ex) { 184 168 $caught = $ex; 185 169 } 186 - $this->assertEqual(true, ($ex instanceof Exception)); 170 + $this->assertTrue($ex instanceof Exception); 187 171 188 172 189 173 // If a user can edit a project, they can join. ··· 194 178 $proj = $this->refreshProject($proj, $user, true); 195 179 $this->joinProject($proj, $user); 196 180 $proj = $this->refreshProject($proj, $user, true); 197 - $this->assertEqual( 198 - true, 181 + $this->assertTrue( 199 182 $proj->isUserMember($user->getPHID()), 200 183 'Join allowed with edit permission.'); 201 184 $this->leaveProject($proj, $user); ··· 209 192 $proj = $this->refreshProject($proj, $user, true); 210 193 $this->joinProject($proj, $user); 211 194 $proj = $this->refreshProject($proj, $user, true); 212 - $this->assertEqual( 213 - true, 195 + $this->assertTrue( 214 196 $proj->isUserMember($user->getPHID()), 215 197 'Join allowed with join permission.'); 216 198 ··· 223 205 $proj = $this->refreshProject($proj, $user, true); 224 206 $this->leaveProject($proj, $user); 225 207 $proj = $this->refreshProject($proj, $user, true); 226 - $this->assertEqual( 227 - false, 208 + $this->assertFalse( 228 209 $proj->isUserMember($user->getPHID()), 229 210 'Leave allowed without any permission.'); 230 211 }
+3 -9
src/applications/repository/engine/__tests__/PhabricatorWorkingCopyPullTestCase.php
··· 6 6 public function testGitPullBasic() { 7 7 $repo = $this->buildPulledRepository('GT'); 8 8 9 - $this->assertEqual( 10 - true, 11 - Filesystem::pathExists($repo->getLocalPath().'/HEAD')); 9 + $this->assertTrue(Filesystem::pathExists($repo->getLocalPath().'/HEAD')); 12 10 } 13 11 14 12 public function testHgPullBasic() { 15 13 $repo = $this->buildPulledRepository('HT'); 16 14 17 - $this->assertEqual( 18 - true, 19 - Filesystem::pathExists($repo->getLocalPath().'/.hg')); 15 + $this->assertTrue(Filesystem::pathExists($repo->getLocalPath().'/.hg')); 20 16 } 21 17 22 18 public function testSVNPullBasic() { ··· 24 20 25 21 // We don't pull local clones for SVN, so we don't expect there to be 26 22 // a working copy. 27 - $this->assertEqual( 28 - false, 29 - Filesystem::pathExists($repo->getLocalPath())); 23 + $this->assertFalse(Filesystem::pathExists($repo->getLocalPath())); 30 24 } 31 25 32 26 }
+3 -6
src/applications/repository/storage/__tests__/PhabricatorRepositoryTestCase.php
··· 33 33 $repo = new PhabricatorRepository(); 34 34 $repo->setVersionControlSystem($git); 35 35 36 - $this->assertEqual( 37 - true, 36 + $this->assertTrue( 38 37 $repo->shouldTrackBranch('imaginary'), 39 38 'Track all branches by default.'); 40 39 ··· 44 43 'master' => true, 45 44 )); 46 45 47 - $this->assertEqual( 48 - true, 46 + $this->assertTrue( 49 47 $repo->shouldTrackBranch('master'), 50 48 'Track listed branches.'); 51 49 52 - $this->assertEqual( 53 - false, 50 + $this->assertFalse( 54 51 $repo->shouldTrackBranch('imaginary'), 55 52 'Do not track unlisted branches.'); 56 53 }
+3 -6
src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php
··· 1072 1072 $caught = $ex; 1073 1073 } 1074 1074 1075 - $this->assertEqual( 1076 - false, 1075 + $this->assertFalse( 1077 1076 ($caught instanceof Exception), 1078 1077 pht('Natural SVN root should work properly.')); 1079 1078 ··· 1097 1096 $caught = $ex; 1098 1097 } 1099 1098 1100 - $this->assertEqual( 1101 - true, 1099 + $this->assertTrue( 1102 1100 ($caught instanceof Exception), 1103 1101 pht('Artificial SVN root should fail.')); 1104 1102 } ··· 1136 1134 1137 1135 $commits = mpull($commits, null, 'getCommitIdentifier'); 1138 1136 1139 - $this->assertEqual( 1140 - true, 1137 + $this->assertTrue( 1141 1138 isset($commits['2']), 1142 1139 'Expect rCHE2 to exist as a foreign stub.'); 1143 1140
+3 -5
src/infrastructure/__tests__/PhabricatorInfrastructureTestCase.php
··· 16 16 */ 17 17 public function testEverythingImplemented() { 18 18 id(new PhutilSymbolLoader())->selectAndLoadSymbols(); 19 - $this->assertEqual(true, true); 19 + $this->assertTrue(true); 20 20 } 21 21 22 22 public function testApplicationsInstalled() { ··· 66 66 } 67 67 68 68 $this->assertEqual(194431, strlen($buf)); 69 - $this->assertEqual(true, phutil_is_utf8_with_only_bmp_characters($buf)); 69 + $this->assertTrue(phutil_is_utf8_with_only_bmp_characters($buf)); 70 70 71 71 $write = id(new HarbormasterScratchTable()) 72 72 ->setData('all.utf8.bmp') ··· 96 96 $caught = $ex; 97 97 } 98 98 99 - $this->assertEqual( 100 - true, 101 - ($caught instanceof AphrontQueryCharacterSetException)); 99 + $this->assertTrue($caught instanceof AphrontQueryCharacterSetException); 102 100 } 103 101 104 102 }
+12 -22
src/infrastructure/daemon/workers/__tests__/PhabricatorWorkerTestCase.php
··· 76 76 'doWork' => 'fail-temporary', 77 77 )); 78 78 79 - $this->assertEqual(false, $task->isArchived()); 80 - $this->assertEqual( 81 - true, 82 - ($task->getExecutionException() instanceof Exception)); 79 + $this->assertFalse($task->isArchived()); 80 + $this->assertTrue($task->getExecutionException() instanceof Exception); 83 81 } 84 82 85 83 public function testTooManyTaskFailures() { ··· 92 90 )); 93 91 94 92 // Temporary... 95 - $this->assertEqual(false, $task->isArchived()); 96 - $this->assertEqual( 97 - true, 98 - ($task->getExecutionException() instanceof Exception)); 93 + $this->assertFalse($task->isArchived()); 94 + $this->assertTrue($task->getExecutionException() instanceof Exception); 99 95 $this->assertEqual(1, $task->getFailureCount()); 100 96 101 97 // Temporary... 102 98 $task = $this->expectNextLease($task); 103 99 $task = $task->executeTask(); 104 - $this->assertEqual(false, $task->isArchived()); 105 - $this->assertEqual( 106 - true, 107 - ($task->getExecutionException() instanceof Exception)); 100 + $this->assertFalse($task->isArchived()); 101 + $this->assertTrue($task->getExecutionException() instanceof Exception); 108 102 $this->assertEqual(2, $task->getFailureCount()); 109 103 110 104 // Temporary... 111 105 $task = $this->expectNextLease($task); 112 106 $task = $task->executeTask(); 113 - $this->assertEqual(false, $task->isArchived()); 114 - $this->assertEqual( 115 - true, 116 - ($task->getExecutionException() instanceof Exception)); 107 + $this->assertFalse($task->isArchived()); 108 + $this->assertTrue($task->getExecutionException() instanceof Exception); 117 109 $this->assertEqual(3, $task->getFailureCount()); 118 110 119 111 // Temporary... 120 112 $task = $this->expectNextLease($task); 121 113 $task = $task->executeTask(); 122 - $this->assertEqual(false, $task->isArchived()); 123 - $this->assertEqual( 124 - true, 125 - ($task->getExecutionException() instanceof Exception)); 114 + $this->assertFalse($task->isArchived()); 115 + $this->assertTrue($task->getExecutionException() instanceof Exception); 126 116 $this->assertEqual(4, $task->getFailureCount()); 127 117 128 118 // Permanent. 129 119 $task = $this->expectNextLease($task); 130 120 $task = $task->executeTask(); 131 - $this->assertEqual(true, $task->isArchived()); 121 + $this->assertTrue($task->isArchived()); 132 122 $this->assertEqual( 133 123 PhabricatorWorkerArchiveTask::RESULT_FAILURE, 134 124 $task->getResult()); ··· 151 141 'getRequiredLeaseTime' => 1000000, 152 142 )); 153 143 154 - $this->assertEqual(true, ($task->getLeaseExpires() - time()) > 1000); 144 + $this->assertTrue(($task->getLeaseExpires() - time()) > 1000); 155 145 } 156 146 157 147 public function testLeasedIsOldestFirst() {
+2 -6
src/infrastructure/edges/__tests__/PhabricatorEdgeTestCase.php
··· 32 32 $caught = $ex; 33 33 } 34 34 35 - $this->assertEqual( 36 - true, 37 - $caught instanceof Exception); 35 + $this->assertTrue($caught instanceof Exception); 38 36 39 37 40 38 // The first edit should go through (no cycle), bu the second one should ··· 56 54 $caught = $ex; 57 55 } 58 56 59 - $this->assertEqual( 60 - true, 61 - $caught instanceof Exception); 57 + $this->assertTrue($caught instanceof Exception); 62 58 } 63 59 64 60
+4 -5
src/infrastructure/env/__tests__/PhabricatorEnvTestCase.php
··· 104 104 $caught = $ex; 105 105 } 106 106 107 - $this->assertEqual(true, ($caught instanceof Exception)); 107 + $this->assertTrue($caught instanceof Exception); 108 108 } 109 109 110 110 public function testOverrides() { ··· 139 139 $caught = $ex; 140 140 } 141 141 142 - $this->assertEqual( 143 - true, 142 + $this->assertTrue( 144 143 $caught instanceof Exception, 145 144 "Destroying a scoped environment which is not on the top of the stack ". 146 145 "should throw."); ··· 163 162 } catch (Exception $ex) { 164 163 $caught = $ex; 165 164 } 166 - $this->assertEqual(true, $caught instanceof Exception); 165 + $this->assertTrue($caught instanceof Exception); 167 166 168 167 $caught = null; 169 168 try { ··· 171 170 } catch (Exception $ex) { 172 171 $caught = $ex; 173 172 } 174 - $this->assertEqual(false, $caught instanceof Exception); 173 + $this->assertFalse($caught instanceof Exception); 175 174 } 176 175 177 176 }
+5 -6
src/infrastructure/storage/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php
··· 18 18 $this->newIsolatedConnection(), 19 19 'INSERT INVALID SYNTAX'); 20 20 21 - $this->assertEqual(true, true); 21 + $this->assertTrue(true); 22 22 } 23 23 24 24 public function testInsertGeneratesID() { ··· 30 30 queryfx($conn, 'INSERT'); 31 31 $id2 = $conn->getInsertID(); 32 32 33 - $this->assertEqual(true, (bool)$id1, 'ID1 exists.'); 34 - $this->assertEqual(true, (bool)$id2, 'ID2 exists.'); 35 - $this->assertEqual( 36 - true, 33 + $this->assertTrue((bool)$id1, 'ID1 exists.'); 34 + $this->assertTrue((bool)$id2, 'ID2 exists.'); 35 + $this->assertTrue( 37 36 $id1 != $id2, 38 37 "IDs '{$id1}' and '{$id2}' are distinct."); 39 38 } ··· 42 41 $conn = $this->newIsolatedConnection(); 43 42 queryfx($conn, 'DELETE'); 44 43 45 - $this->assertEqual(true, true); 44 + $this->assertTrue(true); 46 45 } 47 46 48 47 public function testTransactionStack() {
+1 -1
src/infrastructure/storage/__tests__/AphrontMySQLDatabaseConnectionTestCase.php
··· 31 31 } catch (AphrontQueryConnectionLostException $ex) { 32 32 $caught = $ex; 33 33 } 34 - $this->assertEqual(true, $caught instanceof Exception); 34 + $this->assertTrue($caught instanceof Exception); 35 35 } 36 36 37 37 }
+1 -2
src/infrastructure/storage/__tests__/QueryFormattingTestCase.php
··· 23 23 } catch (Exception $ex) { 24 24 $raised = $ex; 25 25 } 26 - $this->assertEqual( 26 + $this->assertTrue( 27 27 (bool)$raised, 28 - true, 29 28 'qsprintf should raise exception for invalid %d conversion.'); 30 29 31 30 $this->assertEqual(
+3 -4
src/infrastructure/storage/lisk/__tests__/LiskFixtureTestCase.php
··· 65 65 66 66 $obj->killTransaction(); 67 67 68 - $this->assertEqual( 69 - true, 68 + $this->assertTrue( 70 69 ($loaded !== null), 71 70 "Reads inside transactions should have transaction visibility."); 72 71 ··· 91 90 $this->assertEqual(null, $load->load('cow')); 92 91 $this->assertEqual(null, $load->load($id."cow")); 93 92 94 - $this->assertEqual(true, (bool)$load->load((int)$id)); 95 - $this->assertEqual(true, (bool)$load->load((string)$id)); 93 + $this->assertTrue((bool)$load->load((int)$id)); 94 + $this->assertTrue((bool)$load->load((string)$id)); 96 95 } 97 96 98 97 public function testCounters() {
+6 -9
src/infrastructure/storage/lisk/__tests__/LiskIsolationTestCase.php
··· 13 13 $id = $dao->getID(); 14 14 $phid = $dao->getPHID(); 15 15 16 - $this->assertEqual(true, (bool)$id, 'Expect ID generated.'); 17 - $this->assertEqual(true, (bool)$phid, 'Expect PHID generated.'); 16 + $this->assertTrue((bool)$id, 'Expect ID generated.'); 17 + $this->assertTrue((bool)$phid, 'Expect PHID generated.'); 18 18 19 19 $dao->save(); // Effects update 20 20 ··· 54 54 // Expected, pass. 55 55 } 56 56 57 - $this->assertEqual(true, true); 57 + $this->assertTrue(true); 58 58 } 59 59 60 60 public function testMagicMethods() { ··· 82 82 } catch (Exception $thrown) { 83 83 $ex = $thrown; 84 84 } 85 - $this->assertEqual( 86 - true, 85 + $this->assertTrue( 87 86 (bool)$ex, 88 87 'Typoing "get" should throw.'); 89 88 ··· 93 92 } catch (Exception $thrown) { 94 93 $ex = $thrown; 95 94 } 96 - $this->assertEqual( 97 - true, 95 + $this->assertTrue( 98 96 (bool)$ex, 99 97 'Typoing "set" should throw.'); 100 98 ··· 104 102 } catch (Exception $thrown) { 105 103 $ex = $thrown; 106 104 } 107 - $this->assertEqual( 108 - true, 105 + $this->assertTrue( 109 106 (bool)$ex, 110 107 'Made up method should throw.'); 111 108 }
+2 -6
src/infrastructure/time/__tests__/PhabricatorTimeTestCase.php
··· 6 6 $t = 1370202281; 7 7 $time = PhabricatorTime::pushTime($t, 'UTC'); 8 8 9 - $this->assertEqual( 10 - true, 11 - (PhabricatorTime::getNow() === $t)); 9 + $this->assertTrue(PhabricatorTime::getNow() === $t); 12 10 13 11 unset($time); 14 12 15 - $this->assertEqual( 16 - false, 17 - (PhabricatorTime::getNow() === $t)); 13 + $this->assertFalse(PhabricatorTime::getNow() === $t); 18 14 } 19 15 20 16 public function testParseLocalTime() {
+2 -4
src/infrastructure/util/password/__tests__/PhabricatorPasswordHasherTestCase.php
··· 11 11 $caught = $ex; 12 12 } 13 13 14 - $this->assertEqual( 15 - true, 14 + $this->assertTrue( 16 15 ($caught instanceof Exception), 17 16 pht('Exception on unparseable hash format.')); 18 17 ··· 24 23 $caught = $ex; 25 24 } 26 25 27 - $this->assertEqual( 28 - true, 26 + $this->assertTrue( 29 27 ($caught instanceof PhabricatorPasswordHasherUnavailableException), 30 28 pht('Fictional hasher unavailable.')); 31 29 }
+3 -3
src/view/__tests__/PhabricatorAphrontViewTestCase.php
··· 4 4 5 5 public function testHasChildren() { 6 6 $view = new AphrontNullView(); 7 - $this->assertEqual(false, $view->hasChildren()); 7 + $this->assertFalse($view->hasChildren()); 8 8 9 9 $values = array( 10 10 null, ··· 15 15 16 16 foreach ($values as $value) { 17 17 $view->appendChild($value); 18 - $this->assertEqual(false, $view->hasChildren()); 18 + $this->assertFalse($view->hasChildren()); 19 19 } 20 20 21 21 $view->appendChild("!"); 22 - $this->assertEqual(true, $view->hasChildren()); 22 + $this->assertTrue($view->hasChildren()); 23 23 } 24 24 25 25 }
+3 -3
src/view/layout/__tests__/PHUIListViewTestCase.php
··· 23 23 } catch (Exception $ex) { 24 24 $caught = $ex; 25 25 } 26 - $this->assertEqual(true, $caught instanceof Exception); 26 + $this->assertTrue($caught instanceof Exception); 27 27 28 28 $menu->addMenuItemAfter('a', $this->newLink('test2')); 29 29 $menu->addMenuItemAfter(null, $this->newLink('test3')); ··· 52 52 } catch (Exception $ex) { 53 53 $caught = $ex; 54 54 } 55 - $this->assertEqual(true, $caught instanceof Exception); 55 + $this->assertTrue($caught instanceof Exception); 56 56 57 57 $menu->addMenuItemBefore('b', $this->newLink('test2')); 58 58 $menu->addMenuItemBefore(null, $this->newLink('test3')); ··· 83 83 } catch (Exception $ex) { 84 84 $caught = $ex; 85 85 } 86 - $this->assertEqual(true, $caught instanceof Exception); 86 + $this->assertTrue($caught instanceof Exception); 87 87 88 88 $menu->addMenuItemToLabel('fruit', $this->newLink('apple')); 89 89 $menu->addMenuItemToLabel('fruit', $this->newLink('banana'));