Skip to content

Commit

Permalink
Merge pull request #39 from pestphp/feat-coverage
Browse files Browse the repository at this point in the history
feat(runner): Add coverage and rerun support
  • Loading branch information
olivernybroe authored Aug 5, 2020
2 parents 87908f6 + 5f3b2ae commit 8f64c71
Show file tree
Hide file tree
Showing 36 changed files with 641 additions and 254 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
- Add running support with debugger ([#19](https://github.com/pestphp/pest-intellij/pull/19))
- `$this->field` type support for fields declared in `beforeEach` and `beforeAll` functions ([#22](https://github.com/pestphp/pest-intellij/pull/22))
- Run tests scoped based on the cursor ([#24](https://github.com/pestphp/pest-intellij/pull/24), [#26](https://github.com/pestphp/pest-intellij/pull/26))
- Added support for rerun tests when using new pest version ([#39](https://github.com/pestphp/pest-intellij/pull/39))
- Added coverage support with clover output ([#39](https://github.com/pestphp/pest-intellij/pull/39))

### Changed
- Migrated all Java classes to Kotlin

### Fixed
- Plugin require restart as PhpTestFrameworkType does not support dynamic plugins
Expand Down
18 changes: 9 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,23 @@ tasks {
patchPluginXml {
version(pluginVersion)
sinceBuild(pluginSinceBuild)
if (pluginUntilBuild.equals("null")) {
if (pluginUntilBuild == "null") {
untilBuild(null)
} else {
untilBuild(pluginUntilBuild)
}

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription(closure {
File("./README.md").readText().lines().run {
subList(indexOf("<!-- Plugin description -->") + 1, indexOf("<!-- Plugin description end -->"))
}.joinToString("\n").run { markdownToHTML(this) }
})
pluginDescription(
closure {
File("./README.md").readText().lines().run {
subList(indexOf("<!-- Plugin description -->") + 1, indexOf("<!-- Plugin description end -->"))
}.joinToString("\n").run { markdownToHTML(this) }
}
)

// Get the latest available change notes from the changelog file
changeNotes(closure {
changelog.getLatest().toHTML()
})
changeNotes(closure { changelog.getLatest().toHTML() })
}

publishPlugin {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pluginGroup = com.pestphp
pluginName = Pest
pluginVersion = 0.2.1-alpha.4
pluginVersion = 0.3.0
pluginSinceBuild = 201
pluginUntilBuild = null

Expand Down
33 changes: 0 additions & 33 deletions src/main/java/com/pestphp/pest/PestBundle.java

This file was deleted.

25 changes: 0 additions & 25 deletions src/main/java/com/pestphp/pest/PestComposerConfig.java

This file was deleted.

41 changes: 0 additions & 41 deletions src/main/java/com/pestphp/pest/PestFrameworkType.java

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/java/com/pestphp/pest/PestIcons.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.pestphp.pest.configuration;

import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.openapi.project.Project;
import com.jetbrains.php.PhpTestFrameworkVersionDetector;
import com.jetbrains.php.testFramework.PhpTestFrameworkType;
import com.jetbrains.php.testFramework.run.PhpTestRunConfigurationHandler;
import com.jetbrains.php.testFramework.run.PhpTestRunnerSettingsValidator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public abstract class PhpTestRunConfiguration extends com.jetbrains.php.testFramework.run.PhpTestRunConfiguration {
protected PhpTestRunConfiguration(Project project, ConfigurationFactory factory, String name, @NotNull PhpTestFrameworkType frameworkType, @NotNull PhpTestRunnerSettingsValidator validator, @NotNull PhpTestRunConfigurationHandler handler, @Nullable PhpTestFrameworkVersionDetector versionDetector) {
super(project, factory, name, frameworkType, validator, handler, versionDetector);
}

@Override
public void setBeforeRunTasks(@NotNull List value) {
super.setBeforeRunTasks(value);
}
}
14 changes: 14 additions & 0 deletions src/main/kotlin/com/pestphp/pest/PestBundle.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.pestphp.pest

import com.intellij.AbstractBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey

@NonNls
private const val BUNDLE = "pestBundle"

object PestBundle : AbstractBundle(BUNDLE) {
@Suppress("SpreadOperator")
@JvmStatic
fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) = getMessage(key, *params)
}
20 changes: 20 additions & 0 deletions src/main/kotlin/com/pestphp/pest/PestComposerConfig.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.pestphp.pest

import com.intellij.execution.configurations.ConfigurationType
import com.jetbrains.php.testFramework.PhpTestFrameworkComposerConfig
import com.pestphp.pest.configuration.PestRunConfigurationType.Companion.instance

class PestComposerConfig : PhpTestFrameworkComposerConfig(PestFrameworkType.instance, PACKAGE, RELATIVE_PATH) {
override fun getDefaultConfigName(): String {
return "phpunit.xml"
}

override fun getConfigurationType(): ConfigurationType {
return instance
}

companion object {
private const val PACKAGE = "pestphp/pest"
private const val RELATIVE_PATH = "pestphp/pest/bin/pest"
}
}
33 changes: 33 additions & 0 deletions src/main/kotlin/com/pestphp/pest/PestFrameworkType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.pestphp.pest

import com.jetbrains.php.testFramework.PhpTestFrameworkFormDecorator
import com.jetbrains.php.testFramework.PhpTestFrameworkFormDecorator.PhpDownloadableTestFormDecorator
import com.jetbrains.php.testFramework.PhpTestFrameworkType
import org.jetbrains.annotations.Nls
import org.jetbrains.annotations.NonNls
import javax.swing.Icon

class PestFrameworkType : PhpTestFrameworkType() {
override fun getDisplayName(): @Nls String {
return PestBundle.message("FRAMEWORK_NAME")
}

override fun getID(): String {
return ID
}

override fun getIcon(): Icon {
return PestIcons.LOGO
}

override fun getDecorator(): PhpTestFrameworkFormDecorator? {
return PhpDownloadableTestFormDecorator("https://github.com/pestphp/pest/releases")
}

companion object {
@NonNls
val ID = "Pest"
val instance: PhpTestFrameworkType
get() = getTestFrameworkType(ID)
}
}
Loading

0 comments on commit 8f64c71

Please sign in to comment.