Code Duplication    Length = 15-19 lines in 3 locations

tests/ValidatorTest.php 3 locations

@@ 76-90 (lines=15) @@
73
        $this->assertTrue($this->validator->isValid());
74
    }
75
76
    public function testValidateWithErrors()
77
    {
78
        $this->validator->validate($this->request, [
79
            'username' => V::length(8)
80
        ]);
81
82
        $this->assertEquals(['username' => 'a_wurth'], $this->validator->getValues());
83
        $this->assertEquals('a_wurth', $this->validator->getValue('username'));
84
        $this->assertFalse($this->validator->isValid());
85
        $this->assertEquals([
86
            'username' => [
87
                'length' => '"a_wurth" must have a length greater than 8'
88
            ]
89
        ], $this->validator->getErrors());
90
    }
91
92
    public function testValidateWithIndexedErrors()
93
    {
@@ 92-107 (lines=16) @@
89
        ], $this->validator->getErrors());
90
    }
91
92
    public function testValidateWithIndexedErrors()
93
    {
94
        $this->validator->setStoreErrorsWithRules(false);
95
        $this->validator->validate($this->request, [
96
            'username' => V::length(8)
97
        ]);
98
99
        $this->assertEquals(['username' => 'a_wurth'], $this->validator->getValues());
100
        $this->assertEquals('a_wurth', $this->validator->getValue('username'));
101
        $this->assertFalse($this->validator->isValid());
102
        $this->assertEquals([
103
            'username' => [
104
                '"a_wurth" must have a length greater than 8'
105
            ]
106
        ], $this->validator->getErrors());
107
    }
108
109
    public function testValidateWithCustomDefaultMessage()
110
    {
@@ 109-127 (lines=19) @@
106
        ], $this->validator->getErrors());
107
    }
108
109
    public function testValidateWithCustomDefaultMessage()
110
    {
111
        $this->validator->setDefaultMessages([
112
            'length' => 'Too short!'
113
        ]);
114
115
        $this->validator->validate($this->request, [
116
            'username' => V::length(8)
117
        ]);
118
119
        $this->assertEquals(['username' => 'a_wurth'], $this->validator->getValues());
120
        $this->assertEquals('a_wurth', $this->validator->getValue('username'));
121
        $this->assertFalse($this->validator->isValid());
122
        $this->assertEquals([
123
            'username' => [
124
                'length' => 'Too short!'
125
            ]
126
        ], $this->validator->getErrors());
127
    }
128
129
    public function testValidateWithCustomGlobalMessages()
130
    {