Skip to content

Commit

Permalink
fix: Fix name casing inspection
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Nybroe committed May 31, 2023
1 parent 11ca017 commit 1283832
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Fixed file icon missing if all tests has property calls
- Fixed gutter icon not updating state correctly
- Fixed test names with `[` and `]` not being matched correctly
- Fixed test name casing inspection not working correctly with `it` tests

## 1.9.2 - 2023-03-01

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.3-EAP.2
pluginVersion = 1.9.3

# 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 @@ -22,7 +22,12 @@ class InvalidTestNameCaseInspection : PhpInspection() {
file.getPestTests()
.groupBy { it.getPestTestName() }
.filterKeys { it != null }
.filterKeys { !it!!.contains(' ') }
.filterKeys {
// Remove `it ` prefix from test names
val testName = if (it!!.startsWith("it ")) it.substring(3) else it

!testName.contains(' ')
}
.filterKeys { it!!.splitToWords().joinToString(" ") != it }
.forEach {
declareProblemType(holder, it.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
test('basic test', function () {
$this->assertTrue(true);
});

it('is basic test', function () {
$this->assertTrue(true);
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
test(<weak_warning descr="Pest test names words must be space separated.">'basic_test'</weak_warning>, function () {
$this->assertTrue(true);
});
it(<weak_warning descr="Pest test names words must be space separated.">'is_basic_test'</weak_warning>, function () {
$this->assertTrue(true);
});

0 comments on commit 1283832

Please sign in to comment.