1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-31 00:48:21 +01:00

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
This commit is contained in:
Joshua Spence 2014-03-08 19:11:32 -08:00 committed by epriestley
parent 08040ae984
commit e11adc4ad7
30 changed files with 112 additions and 190 deletions

View file

@ -256,8 +256,7 @@ final class PhabricatorAccessControlTestCase
$result = $ex;
}
$this->assertEqual(
true,
$this->assertTrue(
($result === null),
"Expect user '{$uname}' to be allowed access to '{$label}'.");
}
@ -272,8 +271,7 @@ final class PhabricatorAccessControlTestCase
$result = $ex;
}
$this->assertEqual(
false,
$this->assertFalse(
($result === null),
"Expect user '{$uname}' to be denied access to '{$label}'.");
}

View file

@ -7,7 +7,7 @@ final class ConduitCallTestCase extends PhabricatorTestCase {
$call->setForceLocal(true);
$result = $call->execute();
$this->assertEqual(false, empty($result));
$this->assertFalse(empty($result));
}
public function testConduitAuth() {
@ -21,8 +21,7 @@ final class ConduitCallTestCase extends PhabricatorTestCase {
$caught = $ex;
}
$this->assertEqual(
true,
$this->assertTrue(
($caught instanceof ConduitException),
"user.whoami should require authentication");
}

View file

@ -11,7 +11,7 @@ final class DiffusionSSHMercurialWireTestCase
$raw = explode("\n~~~~~~~~~~\n", $raw, 2);
$this->assertEqual(2, count($raw));
$expect = json_decode($raw[1], true);
$this->assertEqual(true, is_array($expect), $file);
$this->assertTrue(is_array($expect), $file);
$this->assertParserResult($expect, $raw[0], $file);
}
@ -49,8 +49,7 @@ final class DiffusionSSHMercurialWireTestCase
$caught = $ex;
}
$this->assertEqual(
true,
$this->assertTrue(
($caught instanceof Exception),
"No extra messages for '{$file}'.");
}

View file

@ -56,7 +56,7 @@ final class PhabricatorFileTestCase extends PhabricatorTestCase {
$first_handle = $first_file->getStorageHandle();
$second_handle = $second_file->getStorageHandle();
$this->assertEqual(true, ($first_handle != $second_handle));
$this->assertTrue($first_handle != $second_handle);
}
@ -107,7 +107,7 @@ final class PhabricatorFileTestCase extends PhabricatorTestCase {
$caught = $ex;
}
$this->assertEqual(true, $caught instanceof Exception);
$this->assertTrue($caught instanceof Exception);
}
public function testFileStorageDeleteSharedHandle() {

View file

@ -16,8 +16,7 @@ final class PhabricatorMailReceiverTestCase extends PhabricatorTestCase {
);
foreach ($same as $address) {
$this->assertEqual(
true,
$this->assertTrue(
PhabricatorMailReceiver::matchAddresses($base, $address),
"Address {$address}");
}
@ -32,8 +31,7 @@ final class PhabricatorMailReceiverTestCase extends PhabricatorTestCase {
);
foreach ($diff as $address) {
$this->assertEqual(
false,
$this->assertFalse(
PhabricatorMailReceiver::matchAddresses($base, $address),
"Address: {$address}");
}

View file

@ -59,8 +59,7 @@ final class PhabricatorMetaMTAMailTestCase extends PhabricatorTestCase {
$mail = new PhabricatorMetaMTAMail();
$mail->addTos(array($phid));
$this->assertEqual(
true,
$this->assertTrue(
in_array($phid, $mail->buildRecipientList()),
'"To" is a recipient.');
@ -68,8 +67,7 @@ final class PhabricatorMetaMTAMailTestCase extends PhabricatorTestCase {
// Test that the "No Self Mail" preference works correctly.
$mail->setFrom($phid);
$this->assertEqual(
true,
$this->assertTrue(
in_array($phid, $mail->buildRecipientList()),
'"From" does not exclude recipients by default.');
@ -78,8 +76,7 @@ final class PhabricatorMetaMTAMailTestCase extends PhabricatorTestCase {
true);
$prefs->save();
$this->assertEqual(
false,
$this->assertFalse(
in_array($phid, $mail->buildRecipientList()),
'"From" excludes recipients with no-self-mail set.');
@ -87,8 +84,7 @@ final class PhabricatorMetaMTAMailTestCase extends PhabricatorTestCase {
PhabricatorUserPreferences::PREFERENCE_NO_SELF_MAIL);
$prefs->save();
$this->assertEqual(
true,
$this->assertTrue(
in_array($phid, $mail->buildRecipientList()),
'"From" does not exclude recipients by default.');
@ -96,8 +92,7 @@ final class PhabricatorMetaMTAMailTestCase extends PhabricatorTestCase {
// Test that explicit exclusion works correctly.
$mail->setExcludeMailRecipientPHIDs(array($phid));
$this->assertEqual(
false,
$this->assertFalse(
in_array($phid, $mail->buildRecipientList()),
'Explicit exclude excludes recipients.');
@ -114,16 +109,14 @@ final class PhabricatorMetaMTAMailTestCase extends PhabricatorTestCase {
$mail->setMailTags(array('test-tag'));
$this->assertEqual(
false,
$this->assertFalse(
in_array($phid, $mail->buildRecipientList()),
'Tag preference excludes recipients.');
$prefs->unsetPreference(PhabricatorUserPreferences::PREFERENCE_MAILTAGS);
$prefs->save();
$this->assertEqual(
true,
$this->assertTrue(
in_array($phid, $mail->buildRecipientList()),
'Recipients restored after tag preference removed.');
}
@ -166,8 +159,7 @@ final class PhabricatorMetaMTAMailTestCase extends PhabricatorTestCase {
$case = "<message-id = ".($supports_message_id ? 'Y' : 'N').", ".
"first = ".($is_first_mail ? 'Y' : 'N').">";
$this->assertEqual(
true,
$this->assertTrue(
isset($dict['Thread-Index']),
"Expect Thread-Index header for case {$case}.");
$this->assertEqual(

View file

@ -16,7 +16,7 @@ final class PhabricatorUserEditorTestCase extends PhabricatorTestCase {
'PhabricatorUserEditorTestCaseOK',
'PhabricatorUserEditorTestCase@example.com');
$this->assertEqual(true, true);
$this->assertTrue(true);
}
public function testRegistrationEmailInvalid() {
@ -34,7 +34,7 @@ final class PhabricatorUserEditorTestCase extends PhabricatorTestCase {
$caught = $ex;
}
$this->assertEqual(true, ($caught instanceof Exception));
$this->assertTrue($caught instanceof Exception);
}
public function testRegistrationEmailDomain() {
@ -50,7 +50,7 @@ final class PhabricatorUserEditorTestCase extends PhabricatorTestCase {
$caught = $ex;
}
$this->assertEqual(true, ($caught instanceof Exception));
$this->assertTrue($caught instanceof Exception);
}
private function registerUser($username, $email) {

View file

@ -36,7 +36,7 @@ final class PhabricatorObjectListQueryTestCase extends PhabricatorTestCase {
} catch (Exception $ex) {
$caught = $ex;
}
$this->assertEqual(true, ($caught instanceof Exception));
$this->assertTrue($caught instanceof Exception);
// Expect failure when loading an invalid object.
@ -46,7 +46,7 @@ final class PhabricatorObjectListQueryTestCase extends PhabricatorTestCase {
} catch (Exception $ex) {
$caught = $ex;
}
$this->assertEqual(true, ($caught instanceof Exception));
$this->assertTrue($caught instanceof Exception);
// Expect failure when loading ANY invalid object, by default.
@ -56,7 +56,7 @@ final class PhabricatorObjectListQueryTestCase extends PhabricatorTestCase {
} catch (Exception $ex) {
$caught = $ex;
}
$this->assertEqual(true, ($caught instanceof Exception));
$this->assertTrue($caught instanceof Exception);
// With partial results, this should load the valid user.

View file

@ -86,7 +86,7 @@ final class PhortuneCurrencyTestCase extends PhabricatorTestCase {
} catch (Exception $ex) {
$caught = $ex;
}
$this->assertEqual(true, ($caught instanceof Exception), "{$input}");
$this->assertTrue($caught instanceof Exception, "{$input}");
}
}

View file

@ -22,8 +22,7 @@ final class PhortunePaymentProviderTestCase extends PhabricatorTestCase {
$caught = $ex;
}
$this->assertEqual(
true,
$this->assertTrue(
($caught instanceof PhortuneNoPaymentProviderException),
'No provider should accept hugs; they are not a currency.');
}
@ -42,8 +41,7 @@ final class PhortunePaymentProviderTestCase extends PhabricatorTestCase {
$caught = $ex;
}
$this->assertEqual(
true,
$this->assertTrue(
($caught instanceof PhortuneMultiplePaymentProvidersException),
'Expect exception when more than one provider handles a payment method.');
}

View file

@ -41,7 +41,7 @@ final class PhrictionDocumentTestCase extends PhabricatorTestCase {
}
if ($expect === null) {
$this->assertEqual(true, (bool)$ex, "Slug '{$slug}' is invalid.");
$this->assertTrue((bool)$ex, "Slug '{$slug}' is invalid.");
} else {
$this->assertEqual($expect, $result, "Slug '{$slug}' identifier.");
}

View file

@ -57,14 +57,14 @@ final class PhabricatorPolicyDataTestCase extends PhabricatorTestCase {
$task,
PhabricatorPolicyCapability::CAN_VIEW);
$this->assertEqual(true, $can_a_view);
$this->assertTrue($can_a_view);
$can_b_view = PhabricatorPolicyFilter::hasCapability(
$user_b,
$task,
PhabricatorPolicyCapability::CAN_VIEW);
$this->assertEqual(false, $can_b_view);
$this->assertFalse($can_b_view);
}
public function testCustomPolicyRuleAdministrators() {
@ -93,14 +93,14 @@ final class PhabricatorPolicyDataTestCase extends PhabricatorTestCase {
$task,
PhabricatorPolicyCapability::CAN_VIEW);
$this->assertEqual(true, $can_a_view);
$this->assertTrue($can_a_view);
$can_b_view = PhabricatorPolicyFilter::hasCapability(
$user_b,
$task,
PhabricatorPolicyCapability::CAN_VIEW);
$this->assertEqual(false, $can_b_view);
$this->assertFalse($can_b_view);
}
public function testCustomPolicyRuleLunarPhase() {
@ -128,7 +128,7 @@ final class PhabricatorPolicyDataTestCase extends PhabricatorTestCase {
$user_a,
$task,
PhabricatorPolicyCapability::CAN_VIEW);
$this->assertEqual(true, $can_a_view);
$this->assertTrue($can_a_view);
unset($time_a);
@ -139,7 +139,7 @@ final class PhabricatorPolicyDataTestCase extends PhabricatorTestCase {
$user_a,
$task,
PhabricatorPolicyCapability::CAN_VIEW);
$this->assertEqual(false, $can_a_view);
$this->assertFalse($can_a_view);
unset($time_b);
}

View file

@ -220,8 +220,7 @@ final class PhabricatorPolicyTestCase extends PhabricatorTestCase {
if (!$class) {
continue;
}
$this->assertEqual(
true,
$this->assertTrue(
(bool)PhabricatorApplication::getByClass($class),
"Application class '{$class}' for query '{$qclass}'");
}
@ -284,8 +283,7 @@ final class PhabricatorPolicyTestCase extends PhabricatorTestCase {
$result,
"{$description} with user {$spec} should succeed.");
} else {
$this->assertEqual(
true,
$this->assertTrue(
$caught instanceof PhabricatorPolicyException,
"{$description} with user {$spec} should fail.");
}

View file

@ -28,12 +28,8 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
$can_view = PhabricatorPolicyCapability::CAN_VIEW;
// When the view policy is set to "users", any user can see the project.
$this->assertEqual(
true,
(bool)$this->refreshProject($proj, $user));
$this->assertEqual(
true,
(bool)$this->refreshProject($proj, $user2));
$this->assertTrue((bool)$this->refreshProject($proj, $user));
$this->assertTrue((bool)$this->refreshProject($proj, $user2));
// When the view policy is set to "no one", members can still see the
@ -41,12 +37,8 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
$proj->setViewPolicy(PhabricatorPolicies::POLICY_NOONE);
$proj->save();
$this->assertEqual(
true,
(bool)$this->refreshProject($proj, $user));
$this->assertEqual(
false,
(bool)$this->refreshProject($proj, $user2));
$this->assertTrue((bool)$this->refreshProject($proj, $user));
$this->assertFalse((bool)$this->refreshProject($proj, $user2));
}
public function testEditProject() {
@ -66,9 +58,7 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
$proj->setEditPolicy(PhabricatorPolicies::POLICY_USER);
$proj->save();
$this->assertEqual(
true,
$this->attemptProjectEdit($proj, $user));
$this->assertTrue($this->attemptProjectEdit($proj, $user));
// When edit policy is set to "no one", no one can edit.
@ -81,7 +71,7 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
} catch (Exception $ex) {
$caught = $ex;
}
$this->assertEqual(true, ($caught instanceof Exception));
$this->assertTrue($caught instanceof Exception);
}
private function attemptProjectEdit(
@ -113,13 +103,11 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
$proj->save();
$proj = $this->refreshProject($proj, $user, true);
$this->assertEqual(
true,
$this->assertTrue(
(bool)$proj,
'Assumption that projects are default visible to any user when created.');
$this->assertEqual(
false,
$this->assertFalse(
$proj->isUserMember($user->getPHID()),
'Arbitrary user not member of project.');
@ -127,10 +115,9 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
$this->joinProject($proj, $user);
$proj = $this->refreshProject($proj, $user, true);
$this->assertEqual(true, (bool)$proj);
$this->assertTrue((bool)$proj);
$this->assertEqual(
true,
$this->assertTrue(
$proj->isUserMember($user->getPHID()),
'Join works.');
@ -139,10 +126,9 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
$this->joinProject($proj, $user);
$proj = $this->refreshProject($proj, $user, true);
$this->assertEqual(true, (bool)$proj);
$this->assertTrue((bool)$proj);
$this->assertEqual(
true,
$this->assertTrue(
$proj->isUserMember($user->getPHID()),
'Joining an already-joined project is a no-op.');
@ -151,10 +137,9 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
$this->leaveProject($proj, $user);
$proj = $this->refreshProject($proj, $user, true);
$this->assertEqual(true, (bool)$proj);
$this->assertTrue((bool)$proj);
$this->assertEqual(
false,
$this->assertFalse(
$proj->isUserMember($user->getPHID()),
'Leave works.');
@ -163,10 +148,9 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
$this->leaveProject($proj, $user);
$proj = $this->refreshProject($proj, $user, true);
$this->assertEqual(true, (bool)$proj);
$this->assertTrue((bool)$proj);
$this->assertEqual(
false,
$this->assertFalse(
$proj->isUserMember($user->getPHID()),
'Leaving an already-left project is a no-op.');
@ -183,7 +167,7 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
} catch (Exception $ex) {
$caught = $ex;
}
$this->assertEqual(true, ($ex instanceof Exception));
$this->assertTrue($ex instanceof Exception);
// If a user can edit a project, they can join.
@ -194,8 +178,7 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
$proj = $this->refreshProject($proj, $user, true);
$this->joinProject($proj, $user);
$proj = $this->refreshProject($proj, $user, true);
$this->assertEqual(
true,
$this->assertTrue(
$proj->isUserMember($user->getPHID()),
'Join allowed with edit permission.');
$this->leaveProject($proj, $user);
@ -209,8 +192,7 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
$proj = $this->refreshProject($proj, $user, true);
$this->joinProject($proj, $user);
$proj = $this->refreshProject($proj, $user, true);
$this->assertEqual(
true,
$this->assertTrue(
$proj->isUserMember($user->getPHID()),
'Join allowed with join permission.');
@ -223,8 +205,7 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
$proj = $this->refreshProject($proj, $user, true);
$this->leaveProject($proj, $user);
$proj = $this->refreshProject($proj, $user, true);
$this->assertEqual(
false,
$this->assertFalse(
$proj->isUserMember($user->getPHID()),
'Leave allowed without any permission.');
}

View file

@ -6,17 +6,13 @@ final class PhabricatorWorkingCopyPullTestCase
public function testGitPullBasic() {
$repo = $this->buildPulledRepository('GT');
$this->assertEqual(
true,
Filesystem::pathExists($repo->getLocalPath().'/HEAD'));
$this->assertTrue(Filesystem::pathExists($repo->getLocalPath().'/HEAD'));
}
public function testHgPullBasic() {
$repo = $this->buildPulledRepository('HT');
$this->assertEqual(
true,
Filesystem::pathExists($repo->getLocalPath().'/.hg'));
$this->assertTrue(Filesystem::pathExists($repo->getLocalPath().'/.hg'));
}
public function testSVNPullBasic() {
@ -24,9 +20,7 @@ final class PhabricatorWorkingCopyPullTestCase
// We don't pull local clones for SVN, so we don't expect there to be
// a working copy.
$this->assertEqual(
false,
Filesystem::pathExists($repo->getLocalPath()));
$this->assertFalse(Filesystem::pathExists($repo->getLocalPath()));
}
}

View file

@ -33,8 +33,7 @@ final class PhabricatorRepositoryTestCase
$repo = new PhabricatorRepository();
$repo->setVersionControlSystem($git);
$this->assertEqual(
true,
$this->assertTrue(
$repo->shouldTrackBranch('imaginary'),
'Track all branches by default.');
@ -44,13 +43,11 @@ final class PhabricatorRepositoryTestCase
'master' => true,
));
$this->assertEqual(
true,
$this->assertTrue(
$repo->shouldTrackBranch('master'),
'Track listed branches.');
$this->assertEqual(
false,
$this->assertFalse(
$repo->shouldTrackBranch('imaginary'),
'Do not track unlisted branches.');
}

View file

@ -1072,8 +1072,7 @@ final class PhabricatorChangeParserTestCase
$caught = $ex;
}
$this->assertEqual(
false,
$this->assertFalse(
($caught instanceof Exception),
pht('Natural SVN root should work properly.'));
@ -1097,8 +1096,7 @@ final class PhabricatorChangeParserTestCase
$caught = $ex;
}
$this->assertEqual(
true,
$this->assertTrue(
($caught instanceof Exception),
pht('Artificial SVN root should fail.'));
}
@ -1136,8 +1134,7 @@ final class PhabricatorChangeParserTestCase
$commits = mpull($commits, null, 'getCommitIdentifier');
$this->assertEqual(
true,
$this->assertTrue(
isset($commits['2']),
'Expect rCHE2 to exist as a foreign stub.');

View file

@ -16,7 +16,7 @@ final class PhabricatorInfrastructureTestCase
*/
public function testEverythingImplemented() {
id(new PhutilSymbolLoader())->selectAndLoadSymbols();
$this->assertEqual(true, true);
$this->assertTrue(true);
}
public function testApplicationsInstalled() {
@ -66,7 +66,7 @@ final class PhabricatorInfrastructureTestCase
}
$this->assertEqual(194431, strlen($buf));
$this->assertEqual(true, phutil_is_utf8_with_only_bmp_characters($buf));
$this->assertTrue(phutil_is_utf8_with_only_bmp_characters($buf));
$write = id(new HarbormasterScratchTable())
->setData('all.utf8.bmp')
@ -96,9 +96,7 @@ final class PhabricatorInfrastructureTestCase
$caught = $ex;
}
$this->assertEqual(
true,
($caught instanceof AphrontQueryCharacterSetException));
$this->assertTrue($caught instanceof AphrontQueryCharacterSetException);
}
}

View file

@ -76,10 +76,8 @@ final class PhabricatorWorkerTestCase extends PhabricatorTestCase {
'doWork' => 'fail-temporary',
));
$this->assertEqual(false, $task->isArchived());
$this->assertEqual(
true,
($task->getExecutionException() instanceof Exception));
$this->assertFalse($task->isArchived());
$this->assertTrue($task->getExecutionException() instanceof Exception);
}
public function testTooManyTaskFailures() {
@ -92,43 +90,35 @@ final class PhabricatorWorkerTestCase extends PhabricatorTestCase {
));
// Temporary...
$this->assertEqual(false, $task->isArchived());
$this->assertEqual(
true,
($task->getExecutionException() instanceof Exception));
$this->assertFalse($task->isArchived());
$this->assertTrue($task->getExecutionException() instanceof Exception);
$this->assertEqual(1, $task->getFailureCount());
// Temporary...
$task = $this->expectNextLease($task);
$task = $task->executeTask();
$this->assertEqual(false, $task->isArchived());
$this->assertEqual(
true,
($task->getExecutionException() instanceof Exception));
$this->assertFalse($task->isArchived());
$this->assertTrue($task->getExecutionException() instanceof Exception);
$this->assertEqual(2, $task->getFailureCount());
// Temporary...
$task = $this->expectNextLease($task);
$task = $task->executeTask();
$this->assertEqual(false, $task->isArchived());
$this->assertEqual(
true,
($task->getExecutionException() instanceof Exception));
$this->assertFalse($task->isArchived());
$this->assertTrue($task->getExecutionException() instanceof Exception);
$this->assertEqual(3, $task->getFailureCount());
// Temporary...
$task = $this->expectNextLease($task);
$task = $task->executeTask();
$this->assertEqual(false, $task->isArchived());
$this->assertEqual(
true,
($task->getExecutionException() instanceof Exception));
$this->assertFalse($task->isArchived());
$this->assertTrue($task->getExecutionException() instanceof Exception);
$this->assertEqual(4, $task->getFailureCount());
// Permanent.
$task = $this->expectNextLease($task);
$task = $task->executeTask();
$this->assertEqual(true, $task->isArchived());
$this->assertTrue($task->isArchived());
$this->assertEqual(
PhabricatorWorkerArchiveTask::RESULT_FAILURE,
$task->getResult());
@ -151,7 +141,7 @@ final class PhabricatorWorkerTestCase extends PhabricatorTestCase {
'getRequiredLeaseTime' => 1000000,
));
$this->assertEqual(true, ($task->getLeaseExpires() - time()) > 1000);
$this->assertTrue(($task->getLeaseExpires() - time()) > 1000);
}
public function testLeasedIsOldestFirst() {

View file

@ -32,9 +32,7 @@ final class PhabricatorEdgeTestCase extends PhabricatorTestCase {
$caught = $ex;
}
$this->assertEqual(
true,
$caught instanceof Exception);
$this->assertTrue($caught instanceof Exception);
// The first edit should go through (no cycle), bu the second one should
@ -56,9 +54,7 @@ final class PhabricatorEdgeTestCase extends PhabricatorTestCase {
$caught = $ex;
}
$this->assertEqual(
true,
$caught instanceof Exception);
$this->assertTrue($caught instanceof Exception);
}

View file

@ -104,7 +104,7 @@ final class PhabricatorEnvTestCase extends PhabricatorTestCase {
$caught = $ex;
}
$this->assertEqual(true, ($caught instanceof Exception));
$this->assertTrue($caught instanceof Exception);
}
public function testOverrides() {
@ -139,8 +139,7 @@ final class PhabricatorEnvTestCase extends PhabricatorTestCase {
$caught = $ex;
}
$this->assertEqual(
true,
$this->assertTrue(
$caught instanceof Exception,
"Destroying a scoped environment which is not on the top of the stack ".
"should throw.");
@ -163,7 +162,7 @@ final class PhabricatorEnvTestCase extends PhabricatorTestCase {
} catch (Exception $ex) {
$caught = $ex;
}
$this->assertEqual(true, $caught instanceof Exception);
$this->assertTrue($caught instanceof Exception);
$caught = null;
try {
@ -171,7 +170,7 @@ final class PhabricatorEnvTestCase extends PhabricatorTestCase {
} catch (Exception $ex) {
$caught = $ex;
}
$this->assertEqual(false, $caught instanceof Exception);
$this->assertFalse($caught instanceof Exception);
}
}

View file

@ -18,7 +18,7 @@ final class AphrontIsolatedDatabaseConnectionTestCase
$this->newIsolatedConnection(),
'INSERT INVALID SYNTAX');
$this->assertEqual(true, true);
$this->assertTrue(true);
}
public function testInsertGeneratesID() {
@ -30,10 +30,9 @@ final class AphrontIsolatedDatabaseConnectionTestCase
queryfx($conn, 'INSERT');
$id2 = $conn->getInsertID();
$this->assertEqual(true, (bool)$id1, 'ID1 exists.');
$this->assertEqual(true, (bool)$id2, 'ID2 exists.');
$this->assertEqual(
true,
$this->assertTrue((bool)$id1, 'ID1 exists.');
$this->assertTrue((bool)$id2, 'ID2 exists.');
$this->assertTrue(
$id1 != $id2,
"IDs '{$id1}' and '{$id2}' are distinct.");
}
@ -42,7 +41,7 @@ final class AphrontIsolatedDatabaseConnectionTestCase
$conn = $this->newIsolatedConnection();
queryfx($conn, 'DELETE');
$this->assertEqual(true, true);
$this->assertTrue(true);
}
public function testTransactionStack() {

View file

@ -31,7 +31,7 @@ final class AphrontMySQLDatabaseConnectionTestCase
} catch (AphrontQueryConnectionLostException $ex) {
$caught = $ex;
}
$this->assertEqual(true, $caught instanceof Exception);
$this->assertTrue($caught instanceof Exception);
}
}

View file

@ -23,9 +23,8 @@ final class QueryFormattingTestCase extends PhabricatorTestCase {
} catch (Exception $ex) {
$raised = $ex;
}
$this->assertEqual(
$this->assertTrue(
(bool)$raised,
true,
'qsprintf should raise exception for invalid %d conversion.');
$this->assertEqual(

View file

@ -65,8 +65,7 @@ final class LiskFixtureTestCase extends PhabricatorTestCase {
$obj->killTransaction();
$this->assertEqual(
true,
$this->assertTrue(
($loaded !== null),
"Reads inside transactions should have transaction visibility.");
@ -91,8 +90,8 @@ final class LiskFixtureTestCase extends PhabricatorTestCase {
$this->assertEqual(null, $load->load('cow'));
$this->assertEqual(null, $load->load($id."cow"));
$this->assertEqual(true, (bool)$load->load((int)$id));
$this->assertEqual(true, (bool)$load->load((string)$id));
$this->assertTrue((bool)$load->load((int)$id));
$this->assertTrue((bool)$load->load((string)$id));
}
public function testCounters() {

View file

@ -13,8 +13,8 @@ final class LiskIsolationTestCase extends PhabricatorTestCase {
$id = $dao->getID();
$phid = $dao->getPHID();
$this->assertEqual(true, (bool)$id, 'Expect ID generated.');
$this->assertEqual(true, (bool)$phid, 'Expect PHID generated.');
$this->assertTrue((bool)$id, 'Expect ID generated.');
$this->assertTrue((bool)$phid, 'Expect PHID generated.');
$dao->save(); // Effects update
@ -54,7 +54,7 @@ final class LiskIsolationTestCase extends PhabricatorTestCase {
// Expected, pass.
}
$this->assertEqual(true, true);
$this->assertTrue(true);
}
public function testMagicMethods() {
@ -82,8 +82,7 @@ final class LiskIsolationTestCase extends PhabricatorTestCase {
} catch (Exception $thrown) {
$ex = $thrown;
}
$this->assertEqual(
true,
$this->assertTrue(
(bool)$ex,
'Typoing "get" should throw.');
@ -93,8 +92,7 @@ final class LiskIsolationTestCase extends PhabricatorTestCase {
} catch (Exception $thrown) {
$ex = $thrown;
}
$this->assertEqual(
true,
$this->assertTrue(
(bool)$ex,
'Typoing "set" should throw.');
@ -104,8 +102,7 @@ final class LiskIsolationTestCase extends PhabricatorTestCase {
} catch (Exception $thrown) {
$ex = $thrown;
}
$this->assertEqual(
true,
$this->assertTrue(
(bool)$ex,
'Made up method should throw.');
}

View file

@ -6,15 +6,11 @@ final class PhabricatorTimeTestCase extends PhabricatorTestCase {
$t = 1370202281;
$time = PhabricatorTime::pushTime($t, 'UTC');
$this->assertEqual(
true,
(PhabricatorTime::getNow() === $t));
$this->assertTrue(PhabricatorTime::getNow() === $t);
unset($time);
$this->assertEqual(
false,
(PhabricatorTime::getNow() === $t));
$this->assertFalse(PhabricatorTime::getNow() === $t);
}
public function testParseLocalTime() {

View file

@ -11,8 +11,7 @@ final class PhabricatorPasswordHasherTestCase extends PhabricatorTestCase {
$caught = $ex;
}
$this->assertEqual(
true,
$this->assertTrue(
($caught instanceof Exception),
pht('Exception on unparseable hash format.'));
@ -24,8 +23,7 @@ final class PhabricatorPasswordHasherTestCase extends PhabricatorTestCase {
$caught = $ex;
}
$this->assertEqual(
true,
$this->assertTrue(
($caught instanceof PhabricatorPasswordHasherUnavailableException),
pht('Fictional hasher unavailable.'));
}

View file

@ -4,7 +4,7 @@ final class PhabricatorAphrontViewTestCase extends PhabricatorTestCase {
public function testHasChildren() {
$view = new AphrontNullView();
$this->assertEqual(false, $view->hasChildren());
$this->assertFalse($view->hasChildren());
$values = array(
null,
@ -15,11 +15,11 @@ final class PhabricatorAphrontViewTestCase extends PhabricatorTestCase {
foreach ($values as $value) {
$view->appendChild($value);
$this->assertEqual(false, $view->hasChildren());
$this->assertFalse($view->hasChildren());
}
$view->appendChild("!");
$this->assertEqual(true, $view->hasChildren());
$this->assertTrue($view->hasChildren());
}
}

View file

@ -23,7 +23,7 @@ final class PHUIListViewTestCase extends PhabricatorTestCase {
} catch (Exception $ex) {
$caught = $ex;
}
$this->assertEqual(true, $caught instanceof Exception);
$this->assertTrue($caught instanceof Exception);
$menu->addMenuItemAfter('a', $this->newLink('test2'));
$menu->addMenuItemAfter(null, $this->newLink('test3'));
@ -52,7 +52,7 @@ final class PHUIListViewTestCase extends PhabricatorTestCase {
} catch (Exception $ex) {
$caught = $ex;
}
$this->assertEqual(true, $caught instanceof Exception);
$this->assertTrue($caught instanceof Exception);
$menu->addMenuItemBefore('b', $this->newLink('test2'));
$menu->addMenuItemBefore(null, $this->newLink('test3'));
@ -83,7 +83,7 @@ final class PHUIListViewTestCase extends PhabricatorTestCase {
} catch (Exception $ex) {
$caught = $ex;
}
$this->assertEqual(true, $caught instanceof Exception);
$this->assertTrue($caught instanceof Exception);
$menu->addMenuItemToLabel('fruit', $this->newLink('apple'));
$menu->addMenuItemToLabel('fruit', $this->newLink('banana'));