Astrotomic / laravel-translatable

A Laravel package for multilingual models
https://docs.astrotomic.info/laravel-translatable/
MIT License
1.22k stars 152 forks source link

Laravel 11 support #387

Closed ifox closed 3 months ago

Gummibeer commented 4 months ago

Hey, I think that PHPunit 11 isn't needed and it seems like it brings some problems as two test runs are failing. 🤔

ifox commented 4 months ago

Hi @Gummibeer, yeah I guess it can wait, pushed a change to stick to PHPUnit 10 for now.

For reference, here's the log from CI:

There were 10 PHPUnit test runner warnings:

1) Class Country cannot be found in /home/runner/work/laravel-translatable/laravel-translatable/tests/Eloquent/Country.php

2) Class CountryStrict cannot be found in /home/runner/work/laravel-translatable/laravel-translatable/tests/Eloquent/CountryStrict.php

3) Class CountryTranslation cannot be found in /home/runner/work/laravel-translatable/laravel-translatable/tests/Eloquent/CountryTranslation.php

4) Class Person cannot be found in /home/runner/work/laravel-translatable/laravel-translatable/tests/Eloquent/Person.php

5) Class PersonTranslation cannot be found in /home/runner/work/laravel-translatable/laravel-translatable/tests/Eloquent/PersonTranslation.php

6) Class StrictTranslation cannot be found in /home/runner/work/laravel-translatable/laravel-translatable/tests/Eloquent/StrictTranslation.php

7) Class Vegetable cannot be found in /home/runner/work/laravel-translatable/laravel-translatable/tests/Eloquent/Vegetable.php

8) Class VegetableTranslation cannot be found in /home/runner/work/laravel-translatable/laravel-translatable/tests/Eloquent/VegetableTranslation.php

9) Class Astrotomic\Translatable\Tests\TestCase declared in /home/runner/work/laravel-translatable/laravel-translatable/tests/TestCase.php is abstract

10) No filter is configured, code coverage will not be processed

--

There was 1 PHPUnit test runner deprecation:

1) Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!

WARNINGS!
Gummibeer commented 4 months ago

Okay, whyever it seems to still fail 🙈🤯

ifox commented 4 months ago

I confirmed locally that tests are running fine with PHPUnit 9. I'll investigate what needs to change as I'm confused by the warningss since the namespaces and PSR definitions are all correct.

Gummibeer commented 4 months ago
orchestra/testbench 9.x-dev requires phpunit/phpunit ^10.5 || ^11.0.1 -> found phpunit/phpunit[dev-main, 10.5.0, ..., 10.5.x-dev, 11.0.1, ..., 11.1.x-dev (alias of dev-main)] but it conflicts with your root composer.json require (^9.0).

We can't have Laravel 11 without PHPunit 10+ 🙈🤯😂

Gummibeer commented 4 months ago

I think that's the problem:

<testsuites>
        <testsuite name="Package Test Suite">
            <directory suffix=".php">./tests/</directory>
            <exclude>./tests/factories/</exclude>
            <exclude>./tests/migrations/</exclude>
            <exclude>./tests/models/</exclude>
        </testsuite>
    </testsuites>

That's super outdated - ./tests/models/ is now ./tests/Eloquent/ the ./tests/migrations/ doesn't exist at all. I assume that PHPunit tries to find a testcase class in the model files. And the suffix=".php" should be suffix="Test.php" to be more precise.

Gummibeer commented 4 months ago

Still crazy that PHPunit errors with a warning but here we are 🙈🤯

$ vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
PHPUnit 10.5.10 by Sebastian Bergmann and contributors.
Configuration: /home/runner/work/laravel-translatable/laravel-translatable/phpunit.xml.dist

There was 1 PHPUnit test runner warning:
1) No filter is configured, code coverage will not be processed
--
There was 1 PHPUnit test runner deprecation:
1) Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!
WARNINGS!

I'm willing to do a whole refresh of the dependencies in the sense of dropping old PHP/Laravel/PHPunit versions that are EoL anyway. Seems like a big challenge to make all versions work together.

Gummibeer commented 4 months ago

https://github.com/Astrotomic/laravel-translatable/pull/390

Gummibeer commented 2 months ago

https://github.com/Astrotomic/laravel-translatable/releases/tag/v11.13.0