Skip to content

Commit

Permalink
feat: Change base path logic
Browse files Browse the repository at this point in the history
  • Loading branch information
olivernybroe committed Feb 13, 2023
1 parent 1687d27 commit 2b7ea28
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
### Fixed
- Fixed running tests with filenames containing `_`.

### Changed
- Changed logic for base path to be from composer.json file.

## 1.9.0 - 2023-01-15

### Added
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 PHP
pluginVersion = 1.9.1-EAP.1
pluginVersion = 1.9.1-EAP.2

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.intellij.psi.PsiRecursiveElementWalkingVisitor
import com.intellij.psi.util.CachedValue
import com.intellij.psi.util.CachedValueProvider
import com.intellij.psi.util.CachedValuesManager
import com.jetbrains.php.composer.lib.ComposerLibraryManager
import com.jetbrains.php.lang.psi.PhpFile
import com.jetbrains.php.lang.psi.elements.MethodReference
import com.jetbrains.php.lang.psi.elements.PhpPsiElement
Expand All @@ -21,7 +22,13 @@ import com.pestphp.pest.getUsesPhpType

class PestConfigurationFileParser(private val settings: PestSettings) {
fun parse(project: Project): PestConfigurationFile {
val baseDir = project.guessProjectDir() ?: return defaultConfig
// Use the location of the composer.json file or the project dir
val baseDir = ComposerLibraryManager.getInstance(project)
.findVendorDirForUpsource()
?.parent
?: project.guessProjectDir()
?: return defaultConfig


val pestFile = VirtualFileManager.getInstance().findFileByUrl(baseDir.url + "/" + settings.pestFilePath)
?: return defaultConfig
Expand Down

0 comments on commit 2b7ea28

Please sign in to comment.