Passed
Pull Request — master (#60)
by Tim
02:14
created

ECPointValueTest::provideECPointValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\Test\XMLSecurity\Type;
6
7
use PHPUnit\Framework\Attributes\CoversClass;
1 ignored issue
show
Bug introduced by
The type PHPUnit\Framework\Attributes\CoversClass was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use PHPUnit\Framework\Attributes\DataProvider;
1 ignored issue
show
Bug introduced by
The type PHPUnit\Framework\Attributes\DataProvider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use PHPUnit\Framework\TestCase;
10
use SimpleSAML\XML\Exception\SchemaViolationException;
11
use SimpleSAML\XMLSecurity\Type\ECPointValue;
12
13
/**
14
 * Class \SimpleSAML\Test\XMLSecurity\Type\ECPointValueTest
15
 *
16
 * @package simplesamlphp/xml-security
17
 */
18
#[CoversClass(ECPointValue::class)]
19
final class ECPointValueTest extends TestCase
20
{
21
    /**
22
     * @param boolean $shouldPass
23
     * @param string $ECPointValue
24
     */
25
    #[DataProvider('provideECPointValue')]
26
    public function testECPointValue(bool $shouldPass, string $ECPointValue): void
27
    {
28
        try {
29
            ECPointValue::fromString($ECPointValue);
30
            $this->assertTrue($shouldPass);
31
        } catch (SchemaViolationException $e) {
32
            $this->assertFalse($shouldPass);
33
        }
34
    }
35
36
37
    /**
38
     * @return array<string, array{0: bool, 1: string}>
39
     */
40
    public static function provideECPointValue(): array
41
    {
42
        return [
43
            'empty' => [false, ''],
44
            'valid' => [true, 'U2ltcGxlU0FNTHBocA=='],
45
            'illegal characters' => [false, '&*$(#&^@!(^%$'],
46
            'length not dividable by 4' => [false, 'U2ltcGxlU0FTHBocA=='],
47
        ];
48
    }
49
}
50