PSR2ProfileDefinition implements BuiltInQualityProfilesDefinition { @Override public void define(Context context) { NewBuiltInQualityProfile profile = context.createBuiltInQualityProfile("PSR-2", Php.KEY); XmlProfileParser.parse("org/sonar/plugins/php/profile/psr2-profile.xml", profile); profile.done(); }  @Override void define(Context context);  }
@Test public void profile_creation() { PSR2ProfileDefinition definition = new PSR2ProfileDefinition(); Context context = new Context(); definition.define(context); BuiltInQualityProfile profile = context.profile("php", "PSR-2"); assertThat(profile.language()).isEqualTo(Php.KEY); assertThat(profile.name()).isEqualTo("PSR-2"); assertThat(profile.rules()).hasSize(20); BuiltInActiveRule lineLengthRule = profile.rule(RuleKey.of("php", "S103")); assertThat(lineLengthRule.overriddenParams()).isEmpty(); assertThat(lineLengthRule.overriddenSeverity()).isNull(); BuiltInActiveRule ruleS1788 = profile.rule(RuleKey.of("php", "S1788")); assertThat(ruleS1788.overriddenParams()).isEmpty(); assertThat(ruleS1788.overriddenSeverity()).isEqualTo("CRITICAL"); BuiltInActiveRule ruleS101 = profile.rule(RuleKey.of("php", "S101")); assertThat(ruleS101.overriddenParam("format").overriddenValue()).isEqualTo("^[A-Z][a-zA-Z]*$"); }