<?php

namespace Kylin\Wechat\Tests;

use Illuminate\Foundation\Application;
use Orchestra\Testbench\TestCase as OrchestraTestCase;
use Kylin\Wechat\Providers\WechatServiceProvider;

/**
 * 测试基类
 */
class TestCase extends OrchestraTestCase
{
    /**
     * 获取包提供者
     *
     * @param Application $app 应用实例
     * @return array
     */
    protected function getPackageProviders($app)
    {
        return [
            WechatServiceProvider::class,
        ];
    }

    /**
     * 获取包别名
     *
     * @param Application $app 应用实例
     * @return array
     */
    protected function getPackageAliases($app)
    {
        return [
            'Wechat' => \Kylin\Wechat\Facades\Wechat::class,
        ];
    }

    /**
     * 定义环境设置
     *
     * @param Application $app 应用实例
     * @return void
     */
    protected function getEnvironmentSetUp($app)
    {
        // 设置环境
        $app['config']->set('wechat', [
            'default' => [
                'official_account' => 'default',
                'mini_program' => 'default',
                'open_platform' => 'default',
                'work' => 'default',
                'open_work' => 'default',
                'payment' => 'default',
            ],
            'accounts' => [
                'official_account' => [
                    'default' => [
                        'app_id' => 'test_app_id',
                        'secret' => 'test_secret',
                        'token' => 'test_token',
                        'aes_key' => 'test_aes_key',
                        'response_type' => 'array',
                    ],
                ],
                'mini_program' => [
                    'default' => [
                        'app_id' => 'test_mini_app_id',
                        'secret' => 'test_mini_secret',
                    ],
                ],
            ],
        ]);
    }
}