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

ResultTest::isValidByDefault()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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