create([ 'config_key' => 'saasshop.amounts.tolerance', 'config_name' => '金额容差(元)', 'config_value' => '0.05', 'value_type' => 'number', 'autoload' => true, 'group' => 'saasshop', 'remark' => '用于测试:从 DB 自动注入到 config()', ]); // 重新执行 provider 的 boot(测试环境中应用在插入前已启动,因此需要手动触发) (new AppServiceProvider($this->app))->boot(); $this->assertSame(0.05, config('saasshop.amounts.tolerance')); } }