Reputation: 4608
When testing with the orchestral testbench Im binding my own class to App\Models\User
in the base TestCase
:
protected function getPackageAliases($app)
{
return [
'App\Models\User' => 'DataStory\Tests\Fake\App\Models\User',
];
}
To test this setup I have this test
public function test_fake_models()
{
$this->assertInstanceOf(
\Illuminate\Database\Eloquent\Builder::class,
\App\Models\User::query()
);
}
The test works fine when running locally. But on github actions:
ErrorException: Class "DataStory\Tests\Fake\App\Models\User" not found
All other tests not depending on the faked User works.
Here is my github actions script: .github/workflows/test.yml
name: tests
on: [push, pull_request]
jobs:
laravel-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout the package
uses: actions/checkout@v2
- name: Install
run: composer install
- name: Run tests
run: ./vendor/bin/phpunit tests
Did I miss something I need to configure in the testbench or what can be my issue?
Upvotes: 0
Views: 173
Reputation: 3428
I think it is because you use Windows which has CI FS (case insensitive filesystem). Ubuntu/GH Actions use CS FS.
You must adjust the case (at least rename app/Models
to App/Models
, see https://github.com/ajthinking/data-story/tree/master/tests/Fake).
Upvotes: 1