• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 20001323174

07 Dec 2025 08:10AM UTC coverage: 25.292% (+0.001%) from 25.291%
20001323174

push

github

soyuka
chore: bump metadata to 4.3.x-dev

14642 of 57891 relevant lines covered (25.29%)

28.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Metadata/Tests/ParameterTest.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Metadata\Tests;
15

16
use ApiPlatform\Metadata\Parameter;
17
use ApiPlatform\Metadata\QueryParameter;
18
use ApiPlatform\State\ParameterNotFound;
19
use PHPUnit\Framework\Attributes\DataProvider;
20
use PHPUnit\Framework\TestCase;
21

22
class ParameterTest extends TestCase
23
{
24
    public function testDefaultValue(): void
25
    {
26
        $this->assertInstanceOf(ParameterNotFound::class, (new QueryParameter())->getValue());
×
27
    }
28

29
    #[DataProvider('provideDefaultValueCases')]
30
    public function testDefaultValueWithFallbackValue(Parameter $parameter, mixed $fallbackValue, mixed $expectedDefault): void
31
    {
32
        $this->assertSame($expectedDefault, $parameter->getValue($fallbackValue));
×
33
    }
34

35
    /** @return iterable<array{Parameter, mixed, mixed}> */
36
    public static function provideDefaultValueCases(): iterable
37
    {
38
        $fallbackValue = new ParameterNotFound();
×
39

40
        yield 'no default specified' => [
×
41
            new QueryParameter(), $fallbackValue, $fallbackValue,
×
42
        ];
×
43

44
        yield 'with a default specified' => [
×
45
            new QueryParameter(default: false), $fallbackValue, false,
×
46
        ];
×
47

48
        yield 'with null as default' => [
×
49
            new QueryParameter(default: null), $fallbackValue,  $fallbackValue,
×
50
        ];
×
51
    }
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc