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