diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 6b35072..f4b61d5 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -7,7 +7,7 @@ on:
jobs:
phpunit:
name: phpunit
- runs-on: ubuntu-22.04
+ runs-on: ubuntu-latest
strategy:
matrix:
php-version:
@@ -48,3 +48,32 @@ jobs:
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
+
+ test-helpers:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ coverage: xdebug
+ php-version: "7.1"
+ ini-values: memory_limit=-1
+ tools: composer:v2
+ - name: Cache dependencies
+ uses: actions/cache@v4
+ with:
+ path: |
+ ~/.composer/cache
+ vendor
+ key: "php-7.1"
+ restore-keys: "php-7.1"
+
+ - name: Install dependencies
+ run: composer install --no-interaction --no-progress
+
+ - name: Run PHPUnit
+ run: make test
+ env:
+ PHPUNIT_VERSION: "07-helpers"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5c65232..9507e2a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,30 @@
# CHANGELOG
-## 2.x to 3.0
+## v3.0.1
+
+### New requirements
+
+None
+
+### New features
+
+None
+
+### Backward Incompatible Changes
+
+None
+
+### Deprecated Features
+
+None
+
+### Other Changes
+
+Fix: Helpers are used, although they are no longer required by default. @donatj
+
+
+
+## v3.0
### New requirements
@@ -26,7 +50,7 @@ None
-## 1.x to 2.0
+## v2.0
### New requirements
diff --git a/phpcs.xml b/phpcs.xml
index eb77ed7..d3d67e1 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -27,4 +27,8 @@
*/lib/Inflections/*
+
+
+ */tests/HelpersTest.php
+
diff --git a/phpunit07-helpers.xml b/phpunit07-helpers.xml
new file mode 100644
index 0000000..389ac39
--- /dev/null
+++ b/phpunit07-helpers.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ tests/HelpersTest.php
+
+
+
+
+
+ lib
+
+
+
diff --git a/phpunit07.xml b/phpunit07.xml
index 48b6aa8..baba08c 100644
--- a/phpunit07.xml
+++ b/phpunit07.xml
@@ -1,7 +1,7 @@
- ./tests
+ tests
+ tests/HelpersTest.php
- ./lib
+ lib
+
+ lib/helpers.php
+
diff --git a/phpunit11.xml b/phpunit11.xml
index a62e4ec..a21545f 100644
--- a/phpunit11.xml
+++ b/phpunit11.xml
@@ -3,7 +3,7 @@
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
- bootstrap="tests/bootstrap.php"
+ bootstrap="vendor/autoload.php"
colors="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerNotices="true"
@@ -14,11 +14,15 @@
tests
+ tests/HelpersTest.php
lib
+
+ lib/helpers.php
+
diff --git a/tests/HelpersTest.php b/tests/HelpersTest.php
index fc36482..ee2e104 100644
--- a/tests/HelpersTest.php
+++ b/tests/HelpersTest.php
@@ -2,6 +2,8 @@
namespace Tests\ICanBoogie;
+require_once __DIR__ . '/../lib/helpers.php';
+
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
diff --git a/tests/InflectionsTest.php b/tests/InflectionsTest.php
index a95580e..67a5ff2 100644
--- a/tests/InflectionsTest.php
+++ b/tests/InflectionsTest.php
@@ -13,13 +13,11 @@
use ICanBoogie\Inflections;
use ICanBoogie\InflectionsNotFound;
+use ICanBoogie\StaticInflector;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
-use function ICanBoogie\pluralize;
-use function ICanBoogie\singularize;
-
/**
* @group integration
*/
@@ -39,7 +37,7 @@ public function test_fail_on_undefined_inflections(): void
#[DataProvider('provide_singular_and_plural')]
public function test_singular_to_plural(string $locale, string $singular, string $plural): void
{
- $this->assertEquals($plural, pluralize($singular, $locale));
+ $this->assertEquals($plural, StaticInflector::pluralize($singular, $locale));
}
/**
@@ -48,7 +46,7 @@ public function test_singular_to_plural(string $locale, string $singular, string
#[DataProvider('provide_singular_and_plural')]
public function test_plural_to_singular(string $locale, string $singular, string $plural): void
{
- $this->assertEquals($singular, singularize($plural, $locale));
+ $this->assertEquals($singular, StaticInflector::singularize($plural, $locale));
}
// @phpstan-ignore-next-line
diff --git a/tests/InflectorTest.php b/tests/InflectorTest.php
index 6d067df..a82d797 100644
--- a/tests/InflectorTest.php
+++ b/tests/InflectorTest.php
@@ -13,10 +13,9 @@
use ICanBoogie\Inflections;
use ICanBoogie\Inflector;
+use ICanBoogie\StaticInflector;
use PHPUnit\Framework\TestCase;
-use function ICanBoogie\camelize;
-
final class InflectorTest extends TestCase
{
/**
@@ -73,39 +72,39 @@ public function test_camelize(): void
foreach ($ar as $camel => $underscore) {
$this->assertEquals($camel, self::$inflector->camelize($underscore));
- $this->assertEquals($camel, camelize($underscore));
+ $this->assertEquals($camel, StaticInflector::camelize($underscore));
}
$ar = require __DIR__ . '/cases/camel_to_dash.php';
foreach ($ar as $camel => $dash) {
$this->assertEquals($camel, self::$inflector->camelize($dash));
- $this->assertEquals($camel, camelize($dash));
+ $this->assertEquals($camel, StaticInflector::camelize($dash));
}
}
public function test_camelize_with_lower_upcases_the_first_letter(): void
{
$this->assertEquals('Capital', self::$inflector->camelize('capital'));
- $this->assertEquals('Capital', camelize('capital'));
+ $this->assertEquals('Capital', StaticInflector::camelize('capital'));
}
public function test_camelize_preserve_words_ends(): void
{
$this->assertEquals('WordOne\\WordTwo', self::$inflector->camelize('wordOne/wordTwo'));
- $this->assertEquals('WordOne\\WordTwo', camelize('wordOne/wordTwo'));
+ $this->assertEquals('WordOne\\WordTwo', StaticInflector::camelize('wordOne/wordTwo'));
}
public function test_camelize_with_lower_downcases_the_first_letter(): void
{
$this->assertEquals('capital', self::$inflector->camelize('Capital', true));
- $this->assertEquals('capital', camelize('Capital', true));
+ $this->assertEquals('capital', StaticInflector::camelize('Capital', true));
}
public function test_camelize_with_underscores(): void
{
$this->assertEquals("CamelCase", self::$inflector->camelize('Camel_Case'));
- $this->assertEquals("CamelCase", camelize('Camel_Case'));
+ $this->assertEquals("CamelCase", StaticInflector::camelize('Camel_Case'));
}
public function test_acronyms(): void
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
deleted file mode 100644
index 86b8736..0000000
--- a/tests/bootstrap.php
+++ /dev/null
@@ -1,4 +0,0 @@
-