forked from SonarSource/sonar-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integration Tests ruling build on travis.
- Loading branch information
1 parent
119958b
commit 9a77e79
Showing
98 changed files
with
112,308 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "its/sources"] | ||
path = its/sources | ||
url = git@github.com:SonarCommunity/php-test-sources.git | ||
url = https://github.com/SonarCommunity/php-test-sources.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>com.sonarsource.parent</groupId> | ||
<artifactId>parent</artifactId> | ||
<version>28</version> | ||
<relativePath/> | ||
</parent> | ||
|
||
<artifactId>it-php-ruling</artifactId> | ||
|
||
<name>PHP :: Integration Tests :: Ruling</name> | ||
<inceptionYear>2014</inceptionYear> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.sonarsource.orchestrator</groupId> | ||
<artifactId>sonar-orchestrator</artifactId> | ||
<version>3.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.10</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.easytesting</groupId> | ||
<artifactId>fest-assert</artifactId> | ||
<version>1.4</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
61 changes: 61 additions & 0 deletions
61
its/ruling/src/test/java/org/sonar/php/it/PHPRulingTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright (C) 2014 SonarSource SA | ||
* All rights reserved | ||
* mailto:contact AT sonarsource DOT com | ||
*/ | ||
package org.sonar.php.it; | ||
|
||
import com.google.common.io.Files; | ||
import com.sonar.orchestrator.Orchestrator; | ||
import com.sonar.orchestrator.build.SonarRunner; | ||
import com.sonar.orchestrator.locator.FileLocation; | ||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.File; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
import static org.fest.assertions.Assertions.assertThat; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
public class PHPRulingTest { | ||
|
||
private static final String PLUGIN_KEY = "php"; | ||
private static final File LITS_DIFFERENCES_FILE = FileLocation.of("target/differences").getFile(); | ||
|
||
@ClassRule | ||
public static Orchestrator ORCHESTRATOR = Orchestrator.builderEnv() | ||
.addPlugin(PLUGIN_KEY) | ||
.setMainPluginKey(PLUGIN_KEY) | ||
.setOrchestratorProperty("litsVersion", "0.5") | ||
.addPlugin("lits") | ||
.restoreProfileAtStartup(FileLocation.of("src/test/resources/profile.xml")) | ||
.build(); | ||
|
||
@Test | ||
public void test() throws Exception { | ||
assertTrue( | ||
"SonarQube 5.1 is the minimum version to generate the issues report, change your orchestrator.properties", | ||
ORCHESTRATOR.getConfiguration().getSonarVersion().isGreaterThanOrEquals("5.1")); | ||
SonarRunner build = SonarRunner.create(FileLocation.of("../sources/src").getFile()) | ||
.setProjectKey("project") | ||
.setProjectName("project") | ||
.setProjectVersion("1") | ||
.setSourceDirs(".") | ||
.setSourceEncoding("UTF-8") | ||
.setProfile("rules") | ||
.setProperty("sonar.analysis.mode", "preview") | ||
.setProperty("sonar.issuesReport.html.enable", "true") | ||
.setProperty("dump.old", FileLocation.of("src/test/resources/expected").getFile().getAbsolutePath()) | ||
.setProperty("dump.new", FileLocation.of("target/actual").getFile().getAbsolutePath()) | ||
.setProperty("sonar.cpd.skip", "true") | ||
.setProperty("lits.differences", LITS_DIFFERENCES_FILE.getAbsolutePath()) | ||
.setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Xmx1000m"); | ||
ORCHESTRATOR.executeBuild(build); | ||
|
||
assertThat(Files.toString(LITS_DIFFERENCES_FILE, StandardCharsets.UTF_8)).isEmpty(); | ||
} | ||
|
||
} |
Oops, something went wrong.