Base64Test::passesProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\Validation\Rules;
6
7
use PHPUnit\Framework\TestCase;
8
9
class Base64Test extends TestCase
10
{
11
    /** @var Base64 - System Under Test */
12
    protected Base64 $sut;
13
14
    public function setUp(): void
15
    {
16
        parent::setUp();
17
18
        $this->sut = new Base64();
19
    }
20
21
    /**
22
     * @return array[]
23
     */
24
    public function passesProvider(): array
25
    {
26
        return [
27
            'empty' => ['', [], true],
28
            'basic' => ['YXNkYXNk', [], true],
29
            'wrong' => ['https://www.example.com/', [], false],
30
        ];
31
    }
32
33
    /**
34
     * @dataProvider passesProvider
35
     *
36
     * @param       $value
37
     * @param array $allValues
38
     * @param bool  $expectedResult
39
     */
40
    public function testPasses($value, array $allValues, bool $expectedResult): void
41
    {
42
        $actualResult = $this->sut->passes($value, $allValues);
43
44
        $this->assertEquals($expectedResult, $actualResult);
45
    }
46
47
    public function testGetSlug(): void
48
    {
49
        $actualResult = $this->sut->getSlug();
50
51
        $this->assertSame('base64', $actualResult);
52
    }
53
}
54