Changeset View
Changeset View
Standalone View
Standalone View
src/unit/engine/__tests__/PhutilUnitTestEngineTestCase.php
| Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | final class PhutilUnitTestEngineTestCase extends PhutilTestCase { | ||||
| public function testPass() { | public function testPass() { | ||||
| $this->assertEqual(1, 1, pht('This test is expected to pass.')); | $this->assertEqual(1, 1, pht('This test is expected to pass.')); | ||||
| } | } | ||||
| public function testFailSkip() { | public function testFailSkip() { | ||||
| $failed = 0; | $failed = 0; | ||||
| $skipped = 0; | $skipped = 0; | ||||
| $test_case = id(new PhutilTestCaseTestCase()) | $test_case = new PhutilTestCaseTestCase(); | ||||
| ->setWorkingCopy($this->getWorkingCopy()); | |||||
| foreach ($test_case->run() as $result) { | foreach ($test_case->run() as $result) { | ||||
| if ($result->getResult() == ArcanistUnitTestResult::RESULT_FAIL) { | if ($result->getResult() == ArcanistUnitTestResult::RESULT_FAIL) { | ||||
| $failed++; | $failed++; | ||||
| } else if ($result->getResult() == ArcanistUnitTestResult::RESULT_SKIP) { | } else if ($result->getResult() == ArcanistUnitTestResult::RESULT_SKIP) { | ||||
| $skipped++; | $skipped++; | ||||
| } else { | } else { | ||||
| $this->assertFailure(pht('These tests should either fail or skip.')); | $this->assertFailure(pht('These tests should either fail or skip.')); | ||||
| ▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | $tests = array( | ||||
| ), | ), | ||||
| ), | ), | ||||
| 'library root' => array( | 'library root' => array( | ||||
| array(phutil_get_library_root('arcanist')), | array(phutil_get_library_root('arcanist')), | ||||
| array(phutil_get_library_root('arcanist').'/__tests__/'), | array(phutil_get_library_root('arcanist').'/__tests__/'), | ||||
| ), | ), | ||||
| ); | ); | ||||
| $test_engine = id(new PhutilUnitTestEngine()) | $test_engine = new PhutilUnitTestEngine(); | ||||
| ->setWorkingCopy($this->getWorkingCopy()); | |||||
| $library = phutil_get_current_library_name(); | $library = phutil_get_current_library_name(); | ||||
| $library_root = phutil_get_library_root($library); | $library_root = phutil_get_library_root($library); | ||||
| foreach ($tests as $name => $test) { | foreach ($tests as $name => $test) { | ||||
| list($paths, $test_paths) = $test; | list($paths, $test_paths) = $test; | ||||
| $expected = array(); | $expected = array(); | ||||
| Show All 16 Lines | |||||