Having this same issue
Missing property when using spatie/laravel-settings when running tests
HI,
I am using laravel-settings 2.1 on a Laravel 8 project, and it has been working fine until now. I need a new setting, so I created a migration:
<?php
use Spatie\LaravelSettings\Migrations\SettingsMigration;
class AddOnboardingVersionSetting extends SettingsMigration
{
public function up(): void
{
$this->migrator->add('general.onboarding_version', 2);
}
};
I updated my GeneralSettings class:
<?php
namespace App\Settings;
use App\Helpers\CarbonIntervalCast;
use Carbon\CarbonInterval;
use Spatie\LaravelSettings\Settings;
class GeneralSettings extends Settings
{
public int $onboarding_version;
public static function group(): string
{
return 'general';
}
}
And I can use it successfully in the code.
When I am running tests with phpunit and Sqlite, all my tests fails with the following error:
Tried loading settings 'App\Settings\GeneralSettings', and following properties were missing: onboarding_version
I was running tests in memory. I switched to a .sqlite file and noticed that my setting is never set in the database, like Sqlite ignores my migration.
There are more settings in this class, and they are all created successfully and cause no issues. Any ideas?
Please or to participate in this conversation.