Passed
Pull Request — master (#41)
by Alexander
12:06 queued 10:41
created

ResultTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 38
rs 10
c 1
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A isValidByDefault() 0 4 1
A errorsAreEmptyByDefault() 0 4 1
A errorIsProperlyAdded() 0 5 1
A addingErrorChangesIsValid() 0 5 1
1
<?php
2
3
4
namespace Yiisoft\Validator\Tests;
5
6
use PHPUnit\Framework\TestCase;
7
use Yiisoft\Validator\Result;
8
9
class ResultTest extends TestCase
10
{
11
    /**
12
     * @test
13
     */
14
    public function isValidByDefault(): void
15
    {
16
        $result = new Result();
17
        $this->assertTrue($result->isValid());
18
    }
19
20
    /**
21
     * @test
22
     */
23
    public function errorsAreEmptyByDefault(): void
24
    {
25
        $result = new Result();
26
        $this->assertEmpty($result->getErrors());
27
    }
28
29
    /**
30
     * @test
31
     */
32
    public function errorIsProperlyAdded(): void
33
    {
34
        $result = new Result();
35
        $result->addError('Error');
36
        $this->assertContains('Error', $result->getErrors());
37
    }
38
39
    /**
40
     * @test
41
     */
42
    public function addingErrorChangesIsValid(): void
43
    {
44
        $result = new Result();
45
        $result->addError('Error');
46
        $this->assertFalse($result->isValid());
47
    }
48
}
49