SkipOnErrorTestTrait::testSkipOnErrorInternal()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 10
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 17
rs 9.9332
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Tests\Rule\Base;
6
7
use Yiisoft\Validator\SkipOnErrorInterface;
8
9
trait SkipOnErrorTestTrait
10
{
11
    abstract public function testSkipOnError(): void;
12
13
    private function testSkipOnErrorInternal(
14
        SkipOnErrorInterface $nonSkippingRule,
15
        SkipOnErrorInterface $skippingRule
16
    ): void {
17
        $this->assertFalse($nonSkippingRule->shouldSkipOnError());
0 ignored issues
show
Bug introduced by
It seems like assertFalse() 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

17
        $this->/** @scrutinizer ignore-call */ 
18
               assertFalse($nonSkippingRule->shouldSkipOnError());
Loading history...
18
19
        $new = $nonSkippingRule->skipOnError(true);
20
        $this->assertFalse($nonSkippingRule->shouldSkipOnError());
21
        $this->assertTrue($new->shouldSkipOnError());
0 ignored issues
show
Bug introduced by
It seems like assertTrue() 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
               assertTrue($new->shouldSkipOnError());
Loading history...
22
        $this->assertNotSame($nonSkippingRule, $new);
0 ignored issues
show
Bug introduced by
It seems like assertNotSame() 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

22
        $this->/** @scrutinizer ignore-call */ 
23
               assertNotSame($nonSkippingRule, $new);
Loading history...
23
24
        $this->assertTrue($skippingRule->shouldSkipOnError());
25
26
        $new = $skippingRule->skipOnError(false);
27
        $this->assertTrue($skippingRule->shouldSkipOnError());
28
        $this->assertFalse($new->shouldSkipOnError());
29
        $this->assertNotSame($skippingRule, $new);
30
    }
31
}
32