orchestral / testbench getPackageAliases() 不适用于 github 动作
orchestral / testbench getPackageAliases() not working on github actions
在使用管弦乐测试台进行测试时,我将自己的 class 绑定到基础 TestCase
:
中的 App\Models\User
protected function getPackageAliases($app)
{
return [
'App\Models\User' => 'DataStory\Tests\Fake\App\Models\User',
];
}
为了测试这个设置,我有这个测试
public function test_fake_models()
{
$this->assertInstanceOf(
\Illuminate\Database\Eloquent\Builder::class,
\App\Models\User::query()
);
}
在本地 运行 时测试工作正常。但是在 github 个动作上:
ErrorException: Class "DataStory\Tests\Fake\App\Models\User" not found
所有其他不依赖于伪造用户的测试。
这是我的 github 动作脚本:.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
我是否遗漏了一些我需要在测试台中配置的东西或者我的问题是什么?
我认为这是因为您使用的 Windows 具有 CI FS(不区分大小写的文件系统)。 Ubuntu/GH动作使用CS FS。
您必须调整大小写(至少将 app/Models
重命名为 App/Models
,请参阅 https://github.com/ajthinking/data-story/tree/master/tests/Fake)。
在使用管弦乐测试台进行测试时,我将自己的 class 绑定到基础 TestCase
:
App\Models\User
protected function getPackageAliases($app)
{
return [
'App\Models\User' => 'DataStory\Tests\Fake\App\Models\User',
];
}
为了测试这个设置,我有这个测试
public function test_fake_models()
{
$this->assertInstanceOf(
\Illuminate\Database\Eloquent\Builder::class,
\App\Models\User::query()
);
}
在本地 运行 时测试工作正常。但是在 github 个动作上:
ErrorException: Class "DataStory\Tests\Fake\App\Models\User" not found
所有其他不依赖于伪造用户的测试。
这是我的 github 动作脚本:.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
我是否遗漏了一些我需要在测试台中配置的东西或者我的问题是什么?
我认为这是因为您使用的 Windows 具有 CI FS(不区分大小写的文件系统)。 Ubuntu/GH动作使用CS FS。
您必须调整大小写(至少将 app/Models
重命名为 App/Models
,请参阅 https://github.com/ajthinking/data-story/tree/master/tests/Fake)。