Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14007985
D8462.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
35 KB
Referenced Files
None
Subscribers
None
D8462.diff
View Options
diff --git a/src/cache/__tests__/PhutilKeyValueCacheTestCase.php b/src/cache/__tests__/PhutilKeyValueCacheTestCase.php
--- a/src/cache/__tests__/PhutilKeyValueCacheTestCase.php
+++ b/src/cache/__tests__/PhutilKeyValueCacheTestCase.php
@@ -71,8 +71,7 @@
foreach ($keys as $key => $value) {
$cached_key = $namespace.':'.$key;
- $this->assertEqual(
- true,
+ $this->assertTrue(
isset($cached_keys[$cached_key]),
$test_info);
diff --git a/src/channel/__tests__/PhutilPHPObjectProtocolChannelTestCase.php b/src/channel/__tests__/PhutilPHPObjectProtocolChannelTestCase.php
--- a/src/channel/__tests__/PhutilPHPObjectProtocolChannelTestCase.php
+++ b/src/channel/__tests__/PhutilPHPObjectProtocolChannelTestCase.php
@@ -15,13 +15,11 @@
$xp->flush();
$result = $yp->waitForMessage();
- $this->assertEqual(
- true,
+ $this->assertTrue(
(array)$object === (array)$result,
"Values are identical.");
- $this->assertEqual(
- false,
+ $this->assertFalse(
$object === $result,
"Objects are not the same.");
}
@@ -43,7 +41,7 @@
// returning, which would be hard to diagnose. Since the current
// implementation shuts down the entire channel, just test for that.
- $this->assertEqual(false, $xp->update(), 'Expected channel to close.');
+ $this->assertFalse($xp->update(), 'Expected channel to close.');
}
public function testCloseExecWriteChannel() {
@@ -61,7 +59,7 @@
// this will time out after 5 seconds and throw.
$future->resolvex();
- $this->assertEqual(true, true);
+ $this->assertTrue(true);
}
diff --git a/src/error/__tests__/PhutilErrorHandlerTestCase.php b/src/error/__tests__/PhutilErrorHandlerTestCase.php
--- a/src/error/__tests__/PhutilErrorHandlerTestCase.php
+++ b/src/error/__tests__/PhutilErrorHandlerTestCase.php
@@ -17,14 +17,10 @@
public function testSilenceHandler() {
// Errors should normally be logged.
- $this->assertEqual(
- true,
- strlen($this->emitError()) > 0);
+ $this->assertTrue(strlen($this->emitError()) > 0);
// The "@" operator should silence errors.
- $this->assertEqual(
- true,
- @strlen($this->emitError()) === 0);
+ $this->assertTrue(@strlen($this->emitError()) === 0);
}
private function emitError() {
diff --git a/src/error/__tests__/PhutilOpaqueEnvelopeTestCase.php b/src/error/__tests__/PhutilOpaqueEnvelopeTestCase.php
--- a/src/error/__tests__/PhutilOpaqueEnvelopeTestCase.php
+++ b/src/error/__tests__/PhutilOpaqueEnvelopeTestCase.php
@@ -13,35 +13,25 @@
$envelope = new PhutilOpaqueEnvelope($secret);
- $this->assertEqual(
- false,
- strpos(var_export($envelope, true), $secret));
+ $this->assertFalse(strpos(var_export($envelope, true), $secret));
- $this->assertEqual(
- false,
- strpos(print_r($envelope, true), $secret));
+ $this->assertFalse(strpos(print_r($envelope, true), $secret));
ob_start();
var_dump($envelope);
$dump = ob_get_clean();
- $this->assertEqual(
- false,
- strpos($dump, $secret));
+ $this->assertFalse(strpos($dump, $secret));
try {
$this->throwTrace($envelope);
} catch (Exception $ex) {
$trace = $ex->getTrace();
- $this->assertEqual(
- false,
- strpos(print_r($trace, true), $secret));
+ $this->assertFalse(strpos(print_r($trace, true), $secret));
}
$backtrace = $this->getBacktrace($envelope);
- $this->assertEqual(
- false,
- strpos(print_r($backtrace, true), $secret));
+ $this->assertFalse(strpos(print_r($backtrace, true), $secret));
$this->assertEqual($secret, $envelope->openEnvelope());
}
diff --git a/src/filesystem/__tests__/FileFinderTestCase.php b/src/filesystem/__tests__/FileFinderTestCase.php
--- a/src/filesystem/__tests__/FileFinderTestCase.php
+++ b/src/filesystem/__tests__/FileFinderTestCase.php
@@ -24,24 +24,18 @@
$files = $this->findFiles($root, true, 'f', '*', $mode);
// Test whether correct files were found.
- $this->assertEqual(true,
- array_key_exists('test.txt', $files));
- $this->assertEqual(true,
- array_key_exists('file.txt', $files));
- $this->assertEqual(true,
+ $this->assertTrue(array_key_exists('test.txt', $files));
+ $this->assertTrue(array_key_exists('file.txt', $files));
+ $this->assertTrue(
array_key_exists('include_dir.txt/subdir.txt/alsoinclude.txt',
$files));
- $this->assertEqual(false,
- array_key_exists('test', $files));
- $this->assertEqual(true,
- array_key_exists('.hidden.txt', $files));
- $this->assertEqual(false,
- array_key_exists('exclude/file.txt', $files));
- $this->assertEqual(false,
- array_key_exists('include_dir.txt', $files));
+ $this->assertFalse(array_key_exists('test', $files));
+ $this->assertTrue(array_key_exists('.hidden.txt', $files));
+ $this->assertFalse(array_key_exists('exclude/file.txt', $files));
+ $this->assertFalse(array_key_exists('include_dir.txt', $files));
foreach ($files as $file => $checksum) {
- $this->assertEqual(false, is_dir($file));
+ $this->assertFalse(is_dir($file));
}
// Test checksums.
@@ -62,17 +56,17 @@
$files = $this->findFiles($root, false, 'f', '*', $mode);
// Test whether correct files were found.
- $this->assertEqual(true, in_array('test.txt', $files));
- $this->assertEqual(true, in_array('file.txt', $files));
- $this->assertEqual(true, in_array('.hidden.txt', $files));
- $this->assertEqual(true,
+ $this->assertTrue(in_array('test.txt', $files));
+ $this->assertTrue(in_array('file.txt', $files));
+ $this->assertTrue(in_array('.hidden.txt', $files));
+ $this->assertTrue(
in_array('include_dir.txt/subdir.txt/alsoinclude.txt', $files));
- $this->assertEqual(false, in_array('test', $files));
- $this->assertEqual(false, in_array('exclude/file.txt', $files));
- $this->assertEqual(false, in_array('include_dir.txt', $files));
+ $this->assertFalse(in_array('test', $files));
+ $this->assertFalse(in_array('exclude/file.txt', $files));
+ $this->assertFalse(in_array('include_dir.txt', $files));
foreach ($files as $file => $checksum) {
- $this->assertEqual(false, is_dir($file));
+ $this->assertFalse(is_dir($file));
}
}
}
@@ -83,21 +77,15 @@
$files = $this->findFiles($root, true, '', '*', $mode);
// Test whether the correct files were found.
- $this->assertEqual(true,
- array_key_exists('test.txt', $files));
- $this->assertEqual(true,
- array_key_exists('file.txt', $files));
- $this->assertEqual(true,
+ $this->assertTrue(array_key_exists('test.txt', $files));
+ $this->assertTrue(array_key_exists('file.txt', $files));
+ $this->assertTrue(
array_key_exists('include_dir.txt/subdir.txt/alsoinclude.txt',
$files));
- $this->assertEqual(false,
- array_key_exists('test', $files));
- $this->assertEqual(true,
- array_key_exists('.hidden.txt', $files));
- $this->assertEqual(false,
- array_key_exists('exclude/file.txt', $files));
- $this->assertEqual(true,
- array_key_exists('include_dir.txt', $files));
+ $this->assertFalse(array_key_exists('test', $files));
+ $this->assertTrue(array_key_exists('.hidden.txt', $files));
+ $this->assertFalse(array_key_exists('exclude/file.txt', $files));
+ $this->assertTrue(array_key_exists('include_dir.txt', $files));
// Test checksums.
$this->assertEqual($files['test.txt'],
@@ -113,7 +101,7 @@
'*/include_dir.txt/subdir.txt/alsoinclude.txt', $mode);
// Test whether the correct files were found.
- $this->assertEqual(true,
+ $this->assertTrue(
array_key_exists('include_dir.txt/subdir.txt/alsoinclude.txt',
$files));
// Ensure that only the one file was found.
diff --git a/src/filesystem/__tests__/FilesystemTestCase.php b/src/filesystem/__tests__/FilesystemTestCase.php
--- a/src/filesystem/__tests__/FilesystemTestCase.php
+++ b/src/filesystem/__tests__/FilesystemTestCase.php
@@ -39,9 +39,9 @@
}
$path = Filesystem::resolveBinary($binary);
- $this->assertEqual(false, null === $path);
- $this->assertEqual(true, file_exists($path));
- $this->assertEqual(false, is_dir($path));
+ $this->assertFalse(null === $path);
+ $this->assertTrue(file_exists($path));
+ $this->assertFalse(is_dir($path));
$this->assertEqual(null,
Filesystem::resolveBinary('halting-problem-decider'));
@@ -57,17 +57,17 @@
// File name should be unique.
$g = Filesystem::writeUniqueFile($dir, 'quack');
- $this->assertEqual(true, ($f != $g));
+ $this->assertTrue($f != $g);
}
public function testReadRandomBytes() {
$number_of_bytes = 1024;
$data = Filesystem::readRandomBytes($number_of_bytes);
- $this->assertEqual(true, (strlen($data) == $number_of_bytes));
+ $this->assertTrue(strlen($data) == $number_of_bytes);
$data1 = Filesystem::readRandomBytes(128);
$data2 = Filesystem::readRandomBytes(128);
- $this->assertEqual(false, $data1 == $data2);
+ $this->assertFalse($data1 == $data2);
$caught = null;
try {
@@ -75,7 +75,7 @@
} catch (Exception $ex) {
$caught = $ex;
}
- $this->assertEqual(true, ($caught instanceof Exception));
+ $this->assertTrue($caught instanceof Exception);
}
diff --git a/src/filesystem/__tests__/PhutilDeferredLogTestCase.php b/src/filesystem/__tests__/PhutilDeferredLogTestCase.php
--- a/src/filesystem/__tests__/PhutilDeferredLogTestCase.php
+++ b/src/filesystem/__tests__/PhutilDeferredLogTestCase.php
@@ -95,7 +95,7 @@
} catch (Exception $ex) {
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testManyWriters() {
@@ -154,7 +154,7 @@
$caught = $ex;
}
- $this->assertEqual(true, ($caught instanceof Exception), 'Set After Write');
+ $this->assertTrue($caught instanceof Exception, 'Set After Write');
}
private function checkLog($expect, $format, $data) {
diff --git a/src/filesystem/__tests__/PhutilFileLockTestCase.php b/src/filesystem/__tests__/PhutilFileLockTestCase.php
--- a/src/filesystem/__tests__/PhutilFileLockTestCase.php
+++ b/src/filesystem/__tests__/PhutilFileLockTestCase.php
@@ -11,13 +11,9 @@
$file = new TempFile();
- $this->assertEqual(
- true,
- $this->lockTest($file));
+ $this->assertTrue($this->lockTest($file));
- $this->assertEqual(
- true,
- $this->lockTest($file));
+ $this->assertTrue($this->lockTest($file));
}
public function testLockHolding() {
@@ -28,15 +24,11 @@
$file = new TempFile();
$hold = $this->holdLock($file);
- $this->assertEqual(
- false,
- $this->lockTest($file));
+ $this->assertFalse($this->lockTest($file));
$hold->resolveKill();
- $this->assertEqual(
- true,
- $this->lockTest($file));
+ $this->assertTrue($this->lockTest($file));
}
public function testInProcessLocking() {
@@ -48,15 +40,11 @@
$lock = PhutilFileLock::newForPath($file);
$lock->lock();
- $this->assertEqual(
- false,
- $this->lockTest($file));
+ $this->assertFalse($this->lockTest($file));
$lock->unlock();
- $this->assertEqual(
- true,
- $this->lockTest($file));
+ $this->assertTrue($this->lockTest($file));
}
public function testInProcessHolding() {
@@ -74,15 +62,11 @@
$caught = $ex;
}
- $this->assertEqual(
- true,
- ($caught instanceof PhutilLockException));
+ $this->assertTrue($caught instanceof PhutilLockException);
$hold->resolveKill();
- $this->assertEqual(
- true,
- $this->lockTest($file));
+ $this->assertTrue($this->lockTest($file));
$lock->lock();
$lock->unlock();
@@ -103,9 +87,7 @@
$caught = $ex;
}
- $this->assertEqual(
- true,
- ($caught instanceof Exception));
+ $this->assertTrue($caught instanceof Exception);
}
public function testExcessiveUnlock() {
@@ -125,9 +107,7 @@
$caught = $ex;
}
- $this->assertEqual(
- true,
- ($caught instanceof Exception));
+ $this->assertTrue($caught instanceof Exception);
}
public function testUnlockAll() {
@@ -139,16 +119,16 @@
$lock->lock();
- $this->assertEqual(false, $this->lockTest($file));
+ $this->assertFalse($this->lockTest($file));
PhutilFileLock::unlockAll();
- $this->assertEqual(true, $this->lockTest($file));
+ $this->assertTrue($this->lockTest($file));
// Calling this again shouldn't do anything bad.
PhutilFileLock::unlockAll();
- $this->assertEqual(true, $this->lockTest($file));
+ $this->assertTrue($this->lockTest($file));
$lock->lock();
$lock->unlock();
@@ -161,15 +141,15 @@
$file = new TempFile();
$lock = PhutilFileLock::newForPath($file);
- $this->assertEqual(false, $lock->isLocked());
+ $this->assertFalse($lock->isLocked());
$lock->lock();
- $this->assertEqual(true, $lock->isLocked());
+ $this->assertTrue($lock->isLocked());
$lock->unlock();
- $this->assertEqual(false, $lock->isLocked());
+ $this->assertFalse($lock->isLocked());
}
private function lockTest($file) {
diff --git a/src/filesystem/linesofalarge/__tests__/LinesOfALargeExecFutureTestCase.php b/src/filesystem/linesofalarge/__tests__/LinesOfALargeExecFutureTestCase.php
--- a/src/filesystem/linesofalarge/__tests__/LinesOfALargeExecFutureTestCase.php
+++ b/src/filesystem/linesofalarge/__tests__/LinesOfALargeExecFutureTestCase.php
@@ -42,7 +42,7 @@
} catch (Exception $ex) {
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof CommandException);
+ $this->assertTrue($caught instanceof CommandException);
}
private function writeAndRead($write, $read) {
diff --git a/src/filesystem/linesofalarge/__tests__/LinesOfALargeFileTestCase.php b/src/filesystem/linesofalarge/__tests__/LinesOfALargeFileTestCase.php
--- a/src/filesystem/linesofalarge/__tests__/LinesOfALargeFileTestCase.php
+++ b/src/filesystem/linesofalarge/__tests__/LinesOfALargeFileTestCase.php
@@ -77,7 +77,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof $ex);
+ $this->assertTrue($caught instanceof $ex);
}
public function testLineFilter() {
diff --git a/src/future/exec/__tests__/ExecFutureTestCase.php b/src/future/exec/__tests__/ExecFutureTestCase.php
--- a/src/future/exec/__tests__/ExecFutureTestCase.php
+++ b/src/future/exec/__tests__/ExecFutureTestCase.php
@@ -79,8 +79,8 @@
$future = new ExecFuture('sleep 32000');
list($err) = $future->setTimeout(0.01)->resolve();
- $this->assertEqual(true, $err > 0);
- $this->assertEqual(true, $future->getWasKilledByTimeout());
+ $this->assertTrue($err > 0);
+ $this->assertTrue($future->getWasKilledByTimeout());
}
public function testMultipleTimeoutsTestShouldRunLessThan1Sec() {
@@ -92,8 +92,8 @@
foreach (Futures($futures) as $future) {
list ($err) = $future->resolve();
- $this->assertEqual(true, $err > 0);
- $this->assertEqual(true, $future->getWasKilledByTimeout());
+ $this->assertTrue($err > 0);
+ $this->assertTrue($future->getWasKilledByTimeout());
}
}
@@ -106,7 +106,7 @@
// If ExecFuture::__destruct() hangs until the child closes, we won't make
// it here in time.
- $this->assertEqual(true, ($end - $start) < 5);
+ $this->assertTrue(($end - $start) < 5);
}
public function testMultipleResolves() {
diff --git a/src/infrastructure/__tests__/PhutilInfrastructureTestCase.php b/src/infrastructure/__tests__/PhutilInfrastructureTestCase.php
--- a/src/infrastructure/__tests__/PhutilInfrastructureTestCase.php
+++ b/src/infrastructure/__tests__/PhutilInfrastructureTestCase.php
@@ -8,6 +8,6 @@
*/
public function testEverythingImplemented() {
id(new PhutilSymbolLoader())->selectAndLoadSymbols();
- $this->assertEqual(true, true);
+ $this->assertTrue(true);
}
}
diff --git a/src/internationalization/__tests__/PhutilTranslatorTestCase.php b/src/internationalization/__tests__/PhutilTranslatorTestCase.php
--- a/src/internationalization/__tests__/PhutilTranslatorTestCase.php
+++ b/src/internationalization/__tests__/PhutilTranslatorTestCase.php
@@ -232,9 +232,7 @@
$string,
$who,
$when);
- $this->assertEqual(
- true,
- ($translation instanceof PhutilSafeHTML));
+ $this->assertTrue($translation instanceof PhutilSafeHTML);
$this->assertEqual(
'<span>Abraham</span> awoke <strong>suddenly</strong> at <4 AM>.',
$translation->getHTMLContent());
diff --git a/src/moduleutils/__tests__/PhutilExtensionsTestCase.php b/src/moduleutils/__tests__/PhutilExtensionsTestCase.php
--- a/src/moduleutils/__tests__/PhutilExtensionsTestCase.php
+++ b/src/moduleutils/__tests__/PhutilExtensionsTestCase.php
@@ -12,9 +12,9 @@
$path = implode(DIRECTORY_SEPARATOR, $path);
phutil_load_library($path);
- $this->assertEqual(true, class_exists('PhutilTestClassA'));
- $this->assertEqual(true, class_exists('PhutilTestClassB'));
- $this->assertEqual(true, class_exists('PhutilTestClassC'));
+ $this->assertTrue(class_exists('PhutilTestClassA'));
+ $this->assertTrue(class_exists('PhutilTestClassB'));
+ $this->assertTrue(class_exists('PhutilTestClassC'));
$symbols = id(new PhutilSymbolLoader())
->setAncestorClass('PhutilTestClassA')
diff --git a/src/parser/__tests__/PhutilBugtraqParserTestCase.php b/src/parser/__tests__/PhutilBugtraqParserTestCase.php
--- a/src/parser/__tests__/PhutilBugtraqParserTestCase.php
+++ b/src/parser/__tests__/PhutilBugtraqParserTestCase.php
@@ -44,9 +44,7 @@
} catch (Exception $ex) {
$caught = $ex;
}
- $this->assertEqual(
- true,
- ($caught instanceof PhutilTypeCheckException));
+ $this->assertTrue($caught instanceof PhutilTypeCheckException);
$caught = null;
@@ -56,9 +54,7 @@
} catch (Exception $ex) {
$caught = $ex;
}
- $this->assertEqual(
- true,
- ($caught instanceof PhutilTypeCheckException));
+ $this->assertTrue($caught instanceof PhutilTypeCheckException);
}
diff --git a/src/parser/__tests__/PhutilParserGeneratorTestCase.php b/src/parser/__tests__/PhutilParserGeneratorTestCase.php
--- a/src/parser/__tests__/PhutilParserGeneratorTestCase.php
+++ b/src/parser/__tests__/PhutilParserGeneratorTestCase.php
@@ -19,7 +19,7 @@
$caught = $ex;
}
- $this->assertEqual(true, ($caught instanceof Exception));
+ $this->assertTrue($caught instanceof Exception);
}
public function testBadStartRule() {
@@ -39,7 +39,7 @@
$caught = $ex;
}
- $this->assertEqual(true, ($caught instanceof Exception));
+ $this->assertTrue($caught instanceof Exception);
}
public function testMessySymbols() {
@@ -70,10 +70,10 @@
$epsilon = $generator->getEpsilonSymbol();
$end = $generator->getEndSymbol();
- $this->assertEqual(false, ($init == '(init)'));
- $this->assertEqual(false, ($eof == '(end-of-file)'));
- $this->assertEqual(false, ($epsilon == '(epsilon)'));
- $this->assertEqual(false, ($end == '(end)'));
+ $this->assertFalse($init == '(init)');
+ $this->assertFalse($eof == '(end-of-file)');
+ $this->assertFalse($epsilon == '(epsilon)');
+ $this->assertFalse($end == '(end)');
$keys = array_keys($rules);
$expect = array('(end-of-file)', '(epsilon)', 's p a c e s', $init);
@@ -111,7 +111,7 @@
$caught = $ex;
}
- $this->assertEqual(true, ($caught instanceof Exception));
+ $this->assertTrue($caught instanceof Exception);
}
public function testUnreachableRule() {
@@ -132,7 +132,7 @@
$caught = $ex;
}
- $this->assertEqual(true, ($caught instanceof Exception));
+ $this->assertTrue($caught instanceof Exception);
}
public function testIrreducibleGrammars() {
@@ -236,7 +236,7 @@
))
->processGrammar();
- $this->assertEqual(true, true);
+ $this->assertTrue(true);
}
public function testETParser() {
diff --git a/src/parser/__tests__/PhutilSimpleOptionsTestCase.php b/src/parser/__tests__/PhutilSimpleOptionsTestCase.php
--- a/src/parser/__tests__/PhutilSimpleOptionsTestCase.php
+++ b/src/parser/__tests__/PhutilSimpleOptionsTestCase.php
@@ -131,8 +131,7 @@
} catch (Exception $ex) {
$caught = $ex;
}
- $this->assertEqual(
- true,
+ $this->assertTrue(
$caught instanceof Exception,
"Correct throw on unparse of bad input.");
}
diff --git a/src/parser/__tests__/PhutilTypeSpecTestCase.php b/src/parser/__tests__/PhutilTypeSpecTestCase.php
--- a/src/parser/__tests__/PhutilTypeSpecTestCase.php
+++ b/src/parser/__tests__/PhutilTypeSpecTestCase.php
@@ -169,7 +169,7 @@
$caught = $ex;
}
- $this->assertEqual(true, ($ex instanceof PhutilTypeCheckException));
+ $this->assertTrue($ex instanceof PhutilTypeCheckException);
}
}
@@ -207,9 +207,7 @@
$caught = $ex;
}
- $this->assertEqual(
- true,
- ($ex instanceof PhutilTypeMissingParametersException));
+ $this->assertTrue($ex instanceof PhutilTypeMissingParametersException);
// Parameter "size" is specified but does not exist.
@@ -225,9 +223,7 @@
$caught = $ex;
}
- $this->assertEqual(
- true,
- ($ex instanceof PhutilTypeExtraParametersException));
+ $this->assertTrue($ex instanceof PhutilTypeExtraParametersException);
}
public function testRegexValidation() {
@@ -252,7 +248,7 @@
$caught = $ex;
}
- $this->assertEqual(true, ($ex instanceof PhutilTypeCheckException));
+ $this->assertTrue($ex instanceof PhutilTypeCheckException);
}
public function testScalarOrListRegexp() {
@@ -288,7 +284,7 @@
'regex' => 'list<regex> | regex',
));
- $this->assertEqual(true, true);
+ $this->assertTrue(true);
}
}
diff --git a/src/parser/argument/__tests__/PhutilArgumentParserTestCase.php b/src/parser/argument/__tests__/PhutilArgumentParserTestCase.php
--- a/src/parser/argument/__tests__/PhutilArgumentParserTestCase.php
+++ b/src/parser/argument/__tests__/PhutilArgumentParserTestCase.php
@@ -46,7 +46,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
$args = new PhutilArgumentParser(array('bin', '--', '--derp', 'a', 'b'));
$args->parseFull($specs);
@@ -81,7 +81,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testDuplicateNames() {
@@ -100,7 +100,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testDuplicateNamesWithParsePartial() {
@@ -121,7 +121,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testDuplicateShortAliases() {
@@ -142,7 +142,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testDuplicateWildcards() {
@@ -163,7 +163,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testDuplicatePartialWildcards() {
@@ -188,7 +188,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testConflictSpecificationWithUnrecognizedArg() {
@@ -208,7 +208,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testConflictSpecificationWithSelf() {
@@ -228,7 +228,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testUnrecognizedFlag() {
@@ -240,7 +240,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testDuplicateFlag() {
@@ -257,7 +257,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testMissingParameterValue() {
@@ -275,7 +275,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testExtraParameterValue() {
@@ -292,7 +292,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testConflictParameterValue() {
@@ -318,7 +318,7 @@
$caught = $ex;
}
- $this->assertEqual(true, $caught instanceof Exception);
+ $this->assertTrue($caught instanceof Exception);
}
public function testParameterValues() {
diff --git a/src/parser/xhpast/__tests__/PHPASTParserTestCase.php b/src/parser/xhpast/__tests__/PHPASTParserTestCase.php
--- a/src/parser/xhpast/__tests__/PHPASTParserTestCase.php
+++ b/src/parser/xhpast/__tests__/PHPASTParserTestCase.php
@@ -119,16 +119,14 @@
$stdout_nice,
pht('Parser output for "%s".', $name));
} else {
- $this->assertEqual(
- false,
+ $this->assertFalse(
($expect_nice == $stdout_nice),
pht('Expected parser to parse "%s" incorrectly.', $name));
}
break;
case 'fail-syntax':
$this->assertEqual(1, $err, pht('Exit code for "%s".', $name));
- $this->assertEqual(
- true,
+ $this->assertTrue(
(bool)preg_match('/syntax error/', $stderr),
pht('Expect "syntax error" in stderr or "%s".', $name));
break;
diff --git a/src/utils/__tests__/AbstractDirectedGraphTestCase.php b/src/utils/__tests__/AbstractDirectedGraphTestCase.php
--- a/src/utils/__tests__/AbstractDirectedGraphTestCase.php
+++ b/src/utils/__tests__/AbstractDirectedGraphTestCase.php
@@ -75,8 +75,7 @@
$raised = $ex;
}
- $this->assertEqual(
- true,
+ $this->assertTrue(
(bool)$raised,
'Exception raised by unloadable edges.');
}
diff --git a/src/utils/__tests__/PhutilLunarPhaseTestCase.php b/src/utils/__tests__/PhutilLunarPhaseTestCase.php
--- a/src/utils/__tests__/PhutilLunarPhaseTestCase.php
+++ b/src/utils/__tests__/PhutilLunarPhaseTestCase.php
@@ -6,52 +6,52 @@
// Aug 11, 1999
$moon = new PhutilLunarPhase(934354800);
- $this->assertEqual(false, $moon->isFull());
- $this->assertEqual(true, $moon->isNew());
- $this->assertEqual(true, $moon->isWaxing());
- $this->assertEqual(false, $moon->isWaning());
+ $this->assertFalse($moon->isFull());
+ $this->assertTrue($moon->isNew());
+ $this->assertTrue($moon->isWaxing());
+ $this->assertFalse($moon->isWaning());
// May 22, 2005
$moon = new PhutilLunarPhase(1116745200);
- $this->assertEqual(true, $moon->isFull());
- $this->assertEqual(false, $moon->isNew());
- $this->assertEqual(true, $moon->isWaxing());
- $this->assertEqual(false, $moon->isWaning());
+ $this->assertTrue($moon->isFull());
+ $this->assertFalse($moon->isNew());
+ $this->assertTrue($moon->isWaxing());
+ $this->assertFalse($moon->isWaning());
// May 23, 2005
$moon = new PhutilLunarPhase(1116831600);
- $this->assertEqual(true, $moon->isFull());
- $this->assertEqual(false, $moon->isNew());
- $this->assertEqual(false, $moon->isWaxing());
- $this->assertEqual(true, $moon->isWaning());
+ $this->assertTrue($moon->isFull());
+ $this->assertFalse($moon->isNew());
+ $this->assertFalse($moon->isWaxing());
+ $this->assertTrue($moon->isWaning());
// May 30, 2005
$moon = new PhutilLunarPhase(1117436400);
- $this->assertEqual(false, $moon->isFull());
- $this->assertEqual(false, $moon->isNew());
- $this->assertEqual(false, $moon->isWaxing());
- $this->assertEqual(true, $moon->isWaning());
+ $this->assertFalse($moon->isFull());
+ $this->assertFalse($moon->isNew());
+ $this->assertFalse($moon->isWaxing());
+ $this->assertTrue($moon->isWaning());
// June 05, 2005
$moon = new PhutilLunarPhase(1117954800);
- $this->assertEqual(false, $moon->isFull());
- $this->assertEqual(false, $moon->isNew());
- $this->assertEqual(false, $moon->isWaxing());
- $this->assertEqual(true, $moon->isWaning());
+ $this->assertFalse($moon->isFull());
+ $this->assertFalse($moon->isNew());
+ $this->assertFalse($moon->isWaxing());
+ $this->assertTrue($moon->isWaning());
// June 06, 2005
$moon = new PhutilLunarPhase(1118041200);
- $this->assertEqual(false, $moon->isFull());
- $this->assertEqual(true, $moon->isNew());
- $this->assertEqual(false, $moon->isWaxing());
- $this->assertEqual(true, $moon->isWaning());
+ $this->assertFalse($moon->isFull());
+ $this->assertTrue($moon->isNew());
+ $this->assertFalse($moon->isWaxing());
+ $this->assertTrue($moon->isWaning());
// Oct 4, 2013
$moon = new PhutilLunarPhase(1380897327);
- $this->assertEqual(false, $moon->isFull());
- $this->assertEqual(true, $moon->isNew());
- $this->assertEqual(true, $moon->isWaxing());
- $this->assertEqual(false, $moon->isWaning());
+ $this->assertFalse($moon->isFull());
+ $this->assertTrue($moon->isNew());
+ $this->assertTrue($moon->isWaxing());
+ $this->assertFalse($moon->isWaning());
}
diff --git a/src/utils/__tests__/PhutilUTF8TestCase.php b/src/utils/__tests__/PhutilUTF8TestCase.php
--- a/src/utils/__tests__/PhutilUTF8TestCase.php
+++ b/src/utils/__tests__/PhutilUTF8TestCase.php
@@ -21,7 +21,7 @@
// For some reason my laptop is segfaulting on long inputs inside
// preg_match(). Forestall this craziness in the common case, at least.
phutil_utf8ize(str_repeat('x', 1024 * 1024));
- $this->assertEqual(true, true);
+ $this->assertTrue(true);
}
public function testUTF8izeInvalidUTF8Fixed() {
@@ -277,7 +277,7 @@
} catch (Exception $ex) {
$caught = $ex;
}
- $this->assertEqual(true, (bool)$caught, 'Requires source encoding.');
+ $this->assertTrue((bool)$caught, 'Requires source encoding.');
$caught = null;
try {
@@ -285,7 +285,7 @@
} catch (Exception $ex) {
$caught = $ex;
}
- $this->assertEqual(true, (bool)$caught, 'Requires target encoding.');
+ $this->assertTrue((bool)$caught, 'Requires target encoding.');
}
@@ -309,7 +309,7 @@
$caught = $ex;
}
- $this->assertEqual(true, (bool)$caught, 'Conversion with bogus encoding.');
+ $this->assertTrue((bool)$caught, 'Conversion with bogus encoding.');
}
@@ -436,7 +436,7 @@
$input = str_repeat("\xEF\xBF\xBF", 1024 * 32);
phutil_is_utf8_with_only_bmp_characters($input);
- $this->assertEqual(true, true);
+ $this->assertTrue(true);
}
public function testUTF8BMP() {
diff --git a/src/utils/__tests__/PhutilUtilsTestCase.php b/src/utils/__tests__/PhutilUtilsTestCase.php
--- a/src/utils/__tests__/PhutilUtilsTestCase.php
+++ b/src/utils/__tests__/PhutilUtilsTestCase.php
@@ -15,9 +15,7 @@
$caught = $ex;
}
- $this->assertEqual(
- true,
- ($caught instanceof InvalidArgumentException));
+ $this->assertTrue($caught instanceof InvalidArgumentException);
}
@@ -70,9 +68,7 @@
$caught = $ex;
}
- $this->assertEqual(
- true,
- ($caught instanceof InvalidArgumentException));
+ $this->assertTrue($caught instanceof InvalidArgumentException);
}
@@ -261,9 +257,7 @@
$caught = $ex;
}
- $this->assertEqual(
- true,
- ($caught instanceof InvalidArgumentException));
+ $this->assertTrue($caught instanceof InvalidArgumentException);
$array = array(
"foo" => "bar",
@@ -276,9 +270,7 @@
$caught = $ex;
}
- $this->assertEqual(
- true,
- ($caught instanceof InvalidArgumentException));
+ $this->assertTrue($caught instanceof InvalidArgumentException);
$tmp = new TempFile();
$resource = fopen($tmp, 'r');
@@ -291,9 +283,7 @@
fclose($resource);
- $this->assertEqual(
- true,
- ($caught instanceof InvalidArgumentException));
+ $this->assertTrue($caught instanceof InvalidArgumentException);
}
@@ -497,8 +487,7 @@
$caught = $ex;
}
- $this->assertEqual(
- true,
+ $this->assertTrue(
($caught instanceof InvalidArgumentException),
'phutil_units("'.$input.'")');
}
diff --git a/src/xsprintf/__tests__/PhutilcsprintfTestCase.php b/src/xsprintf/__tests__/PhutilcsprintfTestCase.php
--- a/src/xsprintf/__tests__/PhutilcsprintfTestCase.php
+++ b/src/xsprintf/__tests__/PhutilcsprintfTestCase.php
@@ -5,24 +5,18 @@
public function testCommandReadableEscapes() {
// For arguments comprised of only characters which are safe in any context,
// %R this should avoid adding quotes.
- $this->assertEqual(
- true,
- ('ab' === (string)csprintf('%R', 'ab')));
+ $this->assertTrue(('ab' === (string)csprintf('%R', 'ab')));
// For arguments which have any characters which are not safe in some
// context, %R should apply standard escaping.
- $this->assertEqual(
- false,
- ('a b' === (string)csprintf('%R', 'a b')));
+ $this->assertFalse(('a b' === (string)csprintf('%R', 'a b')));
}
public function testPasswords() {
// Normal "%s" doesn't do anything special.
$command = csprintf('echo %s', 'hunter2trustno1');
- $this->assertEqual(
- true,
- strpos($command, 'hunter2trustno1') !== false);
+ $this->assertTrue(strpos($command, 'hunter2trustno1') !== false);
// "%P" takes a PhutilOpaqueEnvelope.
$caught = null;
@@ -31,23 +25,17 @@
} catch (Exception $ex) {
$caught = $ex;
}
- $this->assertEqual(
- true,
- ($caught instanceof Exception));
+ $this->assertTrue($caught instanceof Exception);
// "%P" masks the provided value.
$command = csprintf('echo %P', new PhutilOpaqueEnvelope('hunter2trustno1'));
- $this->assertEqual(
- false,
- strpos($command, 'hunter2trustno1'));
+ $this->assertFalse(strpos($command, 'hunter2trustno1'));
// Executing the command works as expected.
list($out) = execx('%C', $command);
- $this->assertEqual(
- true,
- strpos($out, 'hunter2trustno1') !== false);
+ $this->assertTrue(strpos($out, 'hunter2trustno1') !== false);
// Escaping should be robust even when used to escape commands which take
@@ -62,9 +50,7 @@
csprintf(
'echo %P',
new PhutilOpaqueEnvelope('!@#$%^&*()')))));
- $this->assertEqual(
- true,
- strpos($out, '!@#$%^&*()') !== false);
+ $this->assertTrue(strpos($out, '!@#$%^&*()') !== false);
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 30, 1:42 PM (2 w, 1 d ago)
Storage Engine
amazon-s3
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
phabricator/secure/5n/6a/krw5supshdgn3d46
Default Alt Text
D8462.diff (35 KB)
Attached To
Mode
D8462: Utilize `assertFalse` and `assertTrue` methods.
Attached
Detach File
Event Timeline
Log In to Comment