<?php

namespace Kylin\Modules\Tests;

use Illuminate\Container\Container;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Kylin\Modules\Providers\ModulesServiceProvider;

/**
 * 测试基类
 *
 * 所有测试类的基类，提供测试环境设置
 */
abstract class TestCase extends BaseTestCase
{
    /**
     * 设置测试环境
     */
    protected function setUp(): void
    {
        parent::setUp();
    }

    /**
     * 创建应用
     */
    public function createApplication(): Application
    {
        $app = Application::configure()->build();

        $app->register(ModulesServiceProvider::class);

        $app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();

        return $app;
    }
}
