'ArcanistPhutilLibraryLinter' => 'lint/linter/ArcanistPhutilLibraryLinter.php',
'ArcanistPhutilModuleLinter' => 'lint/linter/ArcanistPhutilModuleLinter.php',
'ArcanistPhutilTestCase' => 'unit/engine/phutil/ArcanistPhutilTestCase.php',
+ 'ArcanistPhutilTestCaseTestCase' => 'unit/engine/phutil/testcase/ArcanistPhutilTestCaseTestCase.php',
'ArcanistPhutilTestSkippedException' => 'unit/engine/phutil/testcase/ArcanistPhutilTestSkippedException.php',
'ArcanistPhutilTestTerminatedException' => 'unit/engine/phutil/testcase/ArcanistPhutilTestTerminatedException.php',
'ArcanistPyFlakesLinter' => 'lint/linter/ArcanistPyFlakesLinter.php',
'ArcanistPhpcsLinter' => 'ArcanistLinter',
'ArcanistPhutilLibraryLinter' => 'ArcanistLinter',
'ArcanistPhutilModuleLinter' => 'ArcanistLinter',
+ 'ArcanistPhutilTestCaseTestCase' => 'ArcanistPhutilTestCase',
'ArcanistPhutilTestSkippedException' => 'Exception',
'ArcanistPhutilTestTerminatedException' => 'Exception',
'ArcanistPyFlakesLinter' => 'ArcanistLinter',
self::$allTestsCounter--;
- $actual_test_count = 5;
+ $actual_test_count = 4;
$this->assertEqual(
$actual_test_count,
$this->assertEqual(1, 1, 'This test is expected to pass.');
}
- public function testFail() {
- $this->assertFailure('This test is expected to fail.');
- }
-
- public function testSkip() {
- $this->assertSkipped('This test is expected to skip.');
+ 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() {
*/
final protected function assertSkipped($message) {
$this->skipTest($message);
- throw new ArcanistPhutilTestTerminatedException($message);
+ throw new ArcanistPhutilTestSkippedException($message);
}
--- /dev/null
+<?php
+
+/*
+ * Copyright 2012 Facebook, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Test for @{class:PhutilUnitTestEngineTestCase}.
+ *
+ * @group testcase
+ */
+final class ArcanistPhutilTestCaseTestCase extends ArcanistPhutilTestCase {
+
+ public function testFail() {
+ $this->assertFailure('This test is expected to fail.');
+ }
+
+ public function testSkip() {
+ $this->assertSkipped('This test is expected to skip.');
+ }
+
+}