use of com.kalessil.phpStorm.phpInspectionsEA.inspectors.apiUsage.JsonEncodingApiUsageInspector in project phpinspectionsea by kalessil.
the class JsonEncodingApiUsageInspectorTest method testIfFindsErrorsHandlingPatterns.
public void testIfFindsErrorsHandlingPatterns() {
final PhpLanguageLevel level = PhpLanguageLevel.parse("7.3");
if (level != null && level.getVersionString().equals("7.3")) {
PhpProjectConfigurationFacade.getInstance(myFixture.getProject()).setLanguageLevel(level);
final JsonEncodingApiUsageInspector inspector = new JsonEncodingApiUsageInspector();
inspector.HARDEN_DECODING_RESULT_TYPE = false;
inspector.HARDEN_ERRORS_HANDLING = true;
myFixture.enableInspections(inspector);
myFixture.configureByFile("testData/fixtures/api/json-encoding-errors-handling.php");
myFixture.testHighlighting(true, false, true);
myFixture.getAllQuickFixes().forEach(fix -> myFixture.launchAction(fix));
myFixture.setTestDataPath(".");
myFixture.checkResultByFile("testData/fixtures/api/json-encoding-errors-handling.fixed.php");
}
}
use of com.kalessil.phpStorm.phpInspectionsEA.inspectors.apiUsage.JsonEncodingApiUsageInspector in project phpinspectionsea by kalessil.
the class JsonEncodingApiUsageInspectorTest method testIfFindsReturnTypePatterns.
public void testIfFindsReturnTypePatterns() {
final JsonEncodingApiUsageInspector inspector = new JsonEncodingApiUsageInspector();
inspector.HARDEN_DECODING_RESULT_TYPE = true;
inspector.DECODE_AS_ARRAY = true;
inspector.DECODE_AS_OBJECT = false;
inspector.HARDEN_ERRORS_HANDLING = false;
myFixture.enableInspections(inspector);
myFixture.configureByFile("testData/fixtures/api/json-encoding-return-type.php");
myFixture.testHighlighting(true, false, true);
myFixture.getAllQuickFixes().forEach(fix -> myFixture.launchAction(fix));
myFixture.setTestDataPath(".");
myFixture.checkResultByFile("testData/fixtures/api/json-encoding-return-type.fixed.php");
}
Aggregations