Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F9582900
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/unit/engine/__tests__/PhutilUnitTestEngineTestCase.php b/src/unit/engine/__tests__/PhutilUnitTestEngineTestCase.php
index 717c00b3..aa055910 100644
--- a/src/unit/engine/__tests__/PhutilUnitTestEngineTestCase.php
+++ b/src/unit/engine/__tests__/PhutilUnitTestEngineTestCase.php
@@ -1,112 +1,112 @@
<?php
/**
* Very meta test for @{class:PhutilUnitTestEngine}.
*/
final class PhutilUnitTestEngineTestCase extends ArcanistTestCase {
- static $allTestsCounter = 0;
- static $oneTestCounter = 0;
- static $distinctWillRunTests = array();
- static $distinctDidRunTests = array();
+ private static $allTestsCounter = 0;
+ private static $oneTestCounter = 0;
+ private static $distinctWillRunTests = array();
+ private static $distinctDidRunTests = array();
protected function willRunTests() {
self::$allTestsCounter++;
}
protected function didRunTests() {
$this->assertEqual(
1,
self::$allTestsCounter,
'Expect willRunTests() has been called once.');
self::$allTestsCounter--;
$actual_test_count = 4;
$this->assertEqual(
$actual_test_count,
count(self::$distinctWillRunTests),
'Expect willRunOneTest() was called once for each test.');
$this->assertEqual(
$actual_test_count,
count(self::$distinctDidRunTests),
'Expect didRunOneTest() was called once for each test.');
$this->assertEqual(
self::$distinctWillRunTests,
self::$distinctDidRunTests,
'Expect same tests had pre- and post-run callbacks invoked.');
}
public function __destruct() {
if (self::$allTestsCounter !== 0) {
throw new Exception(
'didRunTests() was not called correctly after tests completed!');
}
}
protected function willRunOneTest($test) {
self::$distinctWillRunTests[$test] = true;
self::$oneTestCounter++;
}
protected function didRunOneTest($test) {
$this->assertEqual(
1,
self::$oneTestCounter,
'Expect willRunOneTest depth to be one.');
self::$distinctDidRunTests[$test] = true;
self::$oneTestCounter--;
}
public function testPass() {
$this->assertEqual(1, 1, 'This test is expected to pass.');
}
public function testFailSkip() {
$failed = 0;
$skipped = 0;
$test_case = new ArcanistPhutilTestCaseTestCase();
foreach ($test_case->run() as $result) {
if ($result->getResult() == ArcanistUnitTestResult::RESULT_FAIL) {
$failed++;
} else if ($result->getResult() == ArcanistUnitTestResult::RESULT_SKIP) {
$skipped++;
} else {
$this->assertFailure('These tests should either fail or skip.');
}
}
$this->assertEqual(1, $failed, 'One test was expected to fail.');
$this->assertEqual(1, $skipped, 'One test was expected to skip.');
}
public function testTryTestCases() {
$this->tryTestCases(
array(
true,
false,
),
array(
true,
false,
),
array($this, 'throwIfFalsey'));
}
public function testTryTestMap() {
$this->tryTestCaseMap(
array(
1 => true,
0 => false,
),
array($this, 'throwIfFalsey'));
}
protected function throwIfFalsey($input) {
if (!$input) {
throw new Exception('This is a negative test case!');
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Oct 11, 08:07 (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
984025
Default Alt Text
(3 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline
Log In to Comment