1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Don't use newInstanceWithoutConstructor in Arcanist unit test

Summary: This requires PHP 5.4. Use `newv()` instead. I don't think the "without constructor" part is meaningful (or desirable). Simplify slightly.

Test Plan: `arc unit --everything`

Reviewers: hach-que, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11450
This commit is contained in:
epriestley 2015-01-20 15:39:21 -08:00
parent 8173ea3eea
commit 1cc8f3f377

View file

@ -11,20 +11,13 @@ abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
* @return ArcanistLinter * @return ArcanistLinter
*/ */
protected final function getLinter() { protected final function getLinter() {
$matches = array(); $matches = null;
if (!preg_match('/^(\w+Linter)TestCase$/', get_class($this), $matches) ||
if (!preg_match('/^(\w+Linter)TestCase$/', get_class($this), $matches)) { !is_subclass_of($matches[1], 'ArcanistLinter')) {
throw new Exception(pht('Unable to infer linter class name.')); throw new Exception(pht('Unable to infer linter class name.'));
} }
$linter = id(new ReflectionClass($matches[1])) return newv($matches[1], array());
->newInstanceWithoutConstructor();
if (!$linter instanceof ArcanistLinter) {
throw new Exception(pht('Unable to infer linter class name.'));
}
return $linter;
} }
public abstract function testLinter(); public abstract function testLinter();