Passed
Pull Request — master (#415)
by
unknown
29:22 queued 26:39
created

RuleWithOptionsTestTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A beforeTestOptions() 0 2 1
A testOptions() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Tests\Rule\Base;
6
7
use Yiisoft\Validator\RuleWithOptionsInterface;
8
9
trait RuleWithOptionsTestTrait
10
{
11
    abstract public function dataOptions(): array;
12
13
    /**
14
     * @dataProvider dataOptions
15
     */
16
    public function testOptions(RuleWithOptionsInterface $rule, array $expectedOptions): void
17
    {
18
        $this->beforeTestOptions();
19
20
        $options = $rule->getOptions();
21
        $this->assertSame($expectedOptions, $options);
0 ignored issues
show
Bug introduced by
It seems like assertSame() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

21
        $this->/** @scrutinizer ignore-call */ 
22
               assertSame($expectedOptions, $options);
Loading history...
22
    }
23
24
    protected function beforeTestOptions(): void
25
    {
26
    }
27
}
28