Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15293800
D17783.id42758.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D17783.id42758.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -292,6 +292,7 @@
'ArcanistPhrequentWorkflow' => 'workflow/ArcanistPhrequentWorkflow.php',
'ArcanistPhutilLibraryLinter' => 'lint/linter/ArcanistPhutilLibraryLinter.php',
'ArcanistPhutilXHPASTLinterStandard' => 'lint/linter/standards/phutil/ArcanistPhutilXHPASTLinterStandard.php',
+ 'ArcanistPhutilXHPASTLinterStandardTestCase' => 'lint/linter/standards/phutil/__tests__/ArcanistPhutilXHPASTLinterStandardTestCase.php',
'ArcanistPlusOperatorOnStringsXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistPlusOperatorOnStringsXHPASTLinterRule.php',
'ArcanistPlusOperatorOnStringsXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistPlusOperatorOnStringsXHPASTLinterRuleTestCase.php',
'ArcanistPregQuoteMisuseXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistPregQuoteMisuseXHPASTLinterRule.php',
@@ -642,7 +643,7 @@
'ArcanistLintWorkflow' => 'ArcanistWorkflow',
'ArcanistLinter' => 'Phobject',
'ArcanistLinterStandard' => 'Phobject',
- 'ArcanistLinterStandardTestCase' => 'PhutilTestCase',
+ 'ArcanistLinterStandardTestCase' => 'ArcanistExternalLinterTestCase',
'ArcanistLinterTestCase' => 'PhutilTestCase',
'ArcanistLintersWorkflow' => 'ArcanistWorkflow',
'ArcanistListAssignmentXHPASTLinterRule' => 'ArcanistXHPASTLinterRule',
@@ -706,6 +707,7 @@
'ArcanistPhrequentWorkflow' => 'ArcanistWorkflow',
'ArcanistPhutilLibraryLinter' => 'ArcanistLinter',
'ArcanistPhutilXHPASTLinterStandard' => 'ArcanistLinterStandard',
+ 'ArcanistPhutilXHPASTLinterStandardTestCase' => 'ArcanistLinterStandardTestCase',
'ArcanistPlusOperatorOnStringsXHPASTLinterRule' => 'ArcanistXHPASTLinterRule',
'ArcanistPlusOperatorOnStringsXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase',
'ArcanistPregQuoteMisuseXHPASTLinterRule' => 'ArcanistXHPASTLinterRule',
diff --git a/src/lint/linter/standards/__tests__/ArcanistLinterStandardTestCase.php b/src/lint/linter/standards/__tests__/ArcanistLinterStandardTestCase.php
--- a/src/lint/linter/standards/__tests__/ArcanistLinterStandardTestCase.php
+++ b/src/lint/linter/standards/__tests__/ArcanistLinterStandardTestCase.php
@@ -1,10 +1,21 @@
<?php
-final class ArcanistLinterStandardTestCase extends PhutilTestCase {
+abstract class ArcanistLinterStandardTestCase
+ extends ArcanistExternalLinterTestCase {
- public function testLoadAllStandards() {
- ArcanistLinterStandard::loadAllStandards();
- $this->assertTrue(true);
+ abstract protected function getTestLinter();
+
+ abstract protected function getTestStandard();
+
+ protected function getLinter() {
+ $linter = $this->getTestLinter();
+ $standard = $this->getTestStandard();
+ foreach ($standard->getLinterConfiguration() as $key => $value) {
+ $linter->setLinterConfigurationValue($key, $value);
+ }
+ $linter->addCustomSeverityMap($standard->getLinterSeverityMap());
+
+ return $linter;
}
}
diff --git a/src/lint/linter/standards/phutil/__tests__/ArcanistPhutilXHPASTLinterStandardTestCase.php b/src/lint/linter/standards/phutil/__tests__/ArcanistPhutilXHPASTLinterStandardTestCase.php
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/standards/phutil/__tests__/ArcanistPhutilXHPASTLinterStandardTestCase.php
@@ -0,0 +1,18 @@
+<?php
+
+class ArcanistPhutilXHPASTLinterStandardTestCase
+ extends ArcanistLinterStandardTestCase {
+
+ protected function getTestLinter() {
+ return new ArcanistXHPASTLinter();
+ }
+
+ protected function getTestStandard() {
+ return new ArcanistPhutilXHPASTLinterStandard();
+ }
+
+ public function testLinter() {
+ $this->executeTestsInDirectory(dirname(__FILE__).'/xhpast/');
+ }
+
+}
diff --git a/src/lint/linter/standards/phutil/__tests__/xhpast/blacklisted-function.lint-test b/src/lint/linter/standards/phutil/__tests__/xhpast/blacklisted-function.lint-test
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/standards/phutil/__tests__/xhpast/blacklisted-function.lint-test
@@ -0,0 +1,5 @@
+<?php
+
+eval("echo 'hello'");
+~~~~~~~~~~
+error:3:1
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 6, 4:42 AM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7229751
Default Alt Text
D17783.id42758.diff (4 KB)
Attached To
Mode
D17783: Improve `ArcanistLinterStandardTestCase`
Attached
Detach File
Event Timeline
Log In to Comment