RedisRateLimiterTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 18
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSetUp() 0 5 2
A dataSetUp() 0 5 1
1
<?php
2
namespace RazonYang\Yii2\RateLimiter\Tests\Unit;
3
4
use Codeception\Test\Unit;
5
use RazonYang\Yii2\RateLimiter\RedisRateLimiter;
6
7
class RedisRateLimiterTest extends Unit
8
{
9
    /**
10
     * @dataProvider dataSetUp
11
     */
12
    public function testSetUp(array $config): void
13
    {
14
        $limiter = new RedisRateLimiter($config);
15
        foreach ($config as $name => $val) {
16
            $this->assertSame($val, $limiter->$name);
17
        }
18
    }
19
20
    public function dataSetUp(): array
21
    {
22
        return [
23
            [['ttl' => 0, 'prefix' => 'foo']],
24
            [['ttl' => 60, 'prefix' => 'bar']],
25
        ];
26
    }
27
}
28