TestCase::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
namespace Tests;
3
4
use PHPUnit\Framework\TestCase as BaseTestCase;
5
6
abstract class TestCase extends BaseTestCase
7
{
8
    protected function setUp(): void
9
    {
10
        parent::setUp();
11
        // 模拟请求环境
12
        $_SERVER['HTTP_USER_AGENT'] = 'PHPUnit Test';
13
        $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
14
    }
15
16
    protected function getConfig($platform)
0 ignored issues
show
Unused Code introduced by
The parameter $platform is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

16
    protected function getConfig(/** @scrutinizer ignore-unused */ $platform)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
17
    {
18
        return [
19
            'app_id'        => 'test_app_id',
20
            'app_secret'    => 'test_app_secret',
21
            'scope'         => 'test_scope',
22
            'callback'      => 'http://localhost/callback',
23
            'response_type' => 'code',
24
            'grant_type'    => 'authorization_code',
25
            'proxy_url'     => null,
26
        ];
27
    }
28
}