CaiWuXiTong/tests/Feature/FeatureTestCase.php
15061959991 1adf627c0d feat: 财务系统二次开发 - 营销账户账单功能
- 基础环境:Docker 部署配置,源码挂载实时同步
- 修复:super_admin 权限补全、登录重定向循环
- 开发:店铺营销账户账单 - 抖音账户(15字段汇总账单)
- 开发:店铺营销账户账单 - 淘系支付宝账户(8字段流水账单)
- 开发:店铺营销账户账单 - 拼多多账户(7字段流水账单)
- 业务页面导航集成:config/business_navigation.php + Business\Pages 控制器
- 各平台独立表结构和视图,互不影响
2026-07-21 18:43:52 +08:00

64 lines
1.3 KiB
PHP

<?php
namespace Tests\Feature;
use App\Models\Common\Company;
use Faker\Factory as Faker;
use Tests\TestCase;
abstract class FeatureTestCase extends TestCase
{
protected $faker;
protected $user;
protected $company;
protected function setUp(): void
{
parent::setUp();
$this->withoutExceptionHandling();
$this->faker = Faker::create();
$this->user = user_model_class()::first();
$this->company = $this->user->companies()->first();
// Disable debugbar
config(['debugbar.enabled', false]);
}
/**
* Empty for default user.
*
* @param User|null $user
* @param Company|null $company
* @return FeatureTestCase
*/
public function loginAs($user = null, Company $company = null)
{
if (!$user) {
$user = $this->user;
}
if ($company) {
$company->makeCurrent();
}
app('url')->defaults(['company_id' => company_id()]);
return $this->actingAs($user);
}
public function assertFlashLevel($excepted)
{
$flash['level'] = null;
if ($flashMessage = session('flash_notification')) {
$flash = $flashMessage->first();
}
$this->assertEquals($excepted, $flash['level'], json_encode($flash));
}
}