mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-12-26 15:30:57 +01:00
Pass for phutil test that was expected to fail and skip
Summary: I just hope that we will not create `ArcanistPhutilTestCaseTestCaseTestCase`. Also fix a copy/paste error (@edward's this time). Test Plan: `arc unit` Reviewers: epriestley Reviewed By: epriestley CC: edward, aran, Korvin Differential Revision: https://secure.phabricator.com/D2692
This commit is contained in:
parent
6bc4da8c4c
commit
08b53c3803
4 changed files with 53 additions and 8 deletions
|
@ -92,6 +92,7 @@ phutil_register_library_map(array(
|
|||
'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',
|
||||
|
@ -196,6 +197,7 @@ phutil_register_library_map(array(
|
|||
'ArcanistPhpcsLinter' => 'ArcanistLinter',
|
||||
'ArcanistPhutilLibraryLinter' => 'ArcanistLinter',
|
||||
'ArcanistPhutilModuleLinter' => 'ArcanistLinter',
|
||||
'ArcanistPhutilTestCaseTestCase' => 'ArcanistPhutilTestCase',
|
||||
'ArcanistPhutilTestSkippedException' => 'Exception',
|
||||
'ArcanistPhutilTestTerminatedException' => 'Exception',
|
||||
'ArcanistPyFlakesLinter' => 'ArcanistLinter',
|
||||
|
|
|
@ -40,7 +40,7 @@ final class PhutilUnitTestEngineTestCase extends ArcanistPhutilTestCase {
|
|||
|
||||
self::$allTestsCounter--;
|
||||
|
||||
$actual_test_count = 5;
|
||||
$actual_test_count = 4;
|
||||
|
||||
$this->assertEqual(
|
||||
$actual_test_count,
|
||||
|
@ -82,12 +82,21 @@ final class PhutilUnitTestEngineTestCase extends ArcanistPhutilTestCase {
|
|||
$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() {
|
||||
|
|
|
@ -119,7 +119,7 @@ abstract class ArcanistPhutilTestCase {
|
|||
*/
|
||||
final protected function assertSkipped($message) {
|
||||
$this->skipTest($message);
|
||||
throw new ArcanistPhutilTestTerminatedException($message);
|
||||
throw new ArcanistPhutilTestSkippedException($message);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<?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.');
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue