MemcachedRateLimiterTest::testSetUp()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 2
nc 2
nop 1
1
<?php
2
namespace RazonYang\Yii2\RateLimiter\Tests\Unit;
3
4
use Codeception\Test\Unit;
5
use RazonYang\Yii2\RateLimiter\MemcachedRateLimiter;
6
7
class MemcachedRateLimiterTest extends Unit
8
{
9
    /**
10
     * @dataProvider dataSetUp
11
     */
12
    public function testSetUp(array $config): void
13
    {
14
        $limiter = new MemcachedRateLimiter($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