mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-04-05 17:08:24 +02:00
Summary: Ref D8460. Use `$this->assertFalse(...)` and `$this->assertTrue(...)` instead of `$this->assertEqual(false, ...)` and `$this->assertEqual(true, ...)` respectively. Test Plan: `arc unit` Reviewers: #blessed_reviewers, epriestley CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D8461
59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Test for @{class:ArcanistXUnitTestResultParser}.
|
|
*
|
|
* (putting tests in your tests so you can test
|
|
* while you test)
|
|
*
|
|
* @group testcase
|
|
*/
|
|
final class XUnitTestResultParserTestCase extends ArcanistTestCase {
|
|
|
|
public function testAcceptsNoTestsInput() {
|
|
$stubbed_results = Filesystem::readFile(
|
|
dirname(__FILE__).'/testresults/xunit.no-tests');
|
|
$parsed_results = id(new ArcanistXUnitTestResultParser())
|
|
->parseTestResults($stubbed_results);
|
|
|
|
$this->assertEqual(0, count($parsed_results));
|
|
}
|
|
|
|
public function testAcceptsSimpleInput() {
|
|
$stubbed_results = Filesystem::readFile(
|
|
dirname(__FILE__).'/testresults/xunit.simple');
|
|
$parsed_results = id(new ArcanistXUnitTestResultParser())
|
|
->parseTestResults($stubbed_results);
|
|
|
|
$this->assertEqual(3, count($parsed_results));
|
|
}
|
|
|
|
public function testEmptyInputFailure() {
|
|
try {
|
|
$parsed_results = id(new ArcanistXUnitTestResultParser())
|
|
->parseTestResults('');
|
|
|
|
$this->failTest('Should throw on empty input');
|
|
} catch (Exception $e) {
|
|
// OK
|
|
}
|
|
|
|
$this->assertTrue(true);
|
|
}
|
|
|
|
public function testInvalidXmlInputFailure() {
|
|
$stubbed_results = Filesystem::readFile(
|
|
dirname(__FILE__).'/testresults/xunit.invalid-xml');
|
|
try {
|
|
$parsed_results = id(new ArcanistXUnitTestResultParser())
|
|
->parseTestResults($stubbed_results);
|
|
|
|
$this->failTest('Should throw on non-xml input');
|
|
} catch (Exception $e) {
|
|
// OK
|
|
}
|
|
|
|
$this->assertTrue(true);
|
|
}
|
|
|
|
}
|