1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 06:42:41 +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
*/
protected final function getLinter() {
$matches = array();
if (!preg_match('/^(\w+Linter)TestCase$/', get_class($this), $matches)) {
$matches = null;
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.'));
}
$linter = id(new ReflectionClass($matches[1]))
->newInstanceWithoutConstructor();
if (!$linter instanceof ArcanistLinter) {
throw new Exception(pht('Unable to infer linter class name.'));
}
return $linter;
return newv($matches[1], array());
}
public abstract function testLinter();