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

api-platform / core / 10315659289

09 Aug 2024 07:49AM UTC coverage: 7.841% (-0.006%) from 7.847%
10315659289

push

github

soyuka
style: cs fixes

70 of 529 new or added lines in 176 files covered. (13.23%)

160 existing lines in 58 files now uncovered.

12688 of 161818 relevant lines covered (7.84%)

26.86 hits per line

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

0.0
/src/Metadata/Tests/Resource/StringableSecurityParameterTest.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\Resource;
15

16
use ApiPlatform\Metadata\ApiProperty;
17
use ApiPlatform\Metadata\ApiResource;
18
use ApiPlatform\Metadata\Delete;
19
use ApiPlatform\Metadata\Error;
20
use ApiPlatform\Metadata\ErrorResource;
21
use ApiPlatform\Metadata\Get;
22
use ApiPlatform\Metadata\GetCollection;
23
use ApiPlatform\Metadata\GraphQl\Mutation;
24
use ApiPlatform\Metadata\GraphQl\Query;
25
use ApiPlatform\Metadata\GraphQl\QueryCollection;
26
use ApiPlatform\Metadata\GraphQl\Subscription;
27
use ApiPlatform\Metadata\Metadata;
28
use ApiPlatform\Metadata\NotExposed;
29
use ApiPlatform\Metadata\Patch;
30
use ApiPlatform\Metadata\Post;
31
use ApiPlatform\Metadata\Put;
32
use ApiPlatform\Metadata\Tests\Fixtures\Metadata\RestfulApi;
33
use PHPUnit\Framework\TestCase;
34

35
/**
36
 * @author Aurimas Rimkus <aurimas1rimkus@gmail.com>
37
 */
38
final class StringableSecurityParameterTest extends TestCase
39
{
40
    #[\PHPUnit\Framework\Attributes\DataProvider('metadataProvider')]
41
    public function testOnMetadata(Metadata $metadata): void
42
    {
43
        $this->assertSame($metadata->getSecurity(), 'stringable_security');
×
44
        $this->assertSame($metadata->getSecurityPostDenormalize(), 'stringable_security_post_denormalize');
×
45
        $this->assertSame($metadata->getSecurityPostValidation(), 'stringable_security_post_validation');
×
46
    }
47

48
    public static function metadataProvider(): \Generator
49
    {
NEW
50
        $stringableSecurity = new class implements \Stringable {
×
51
            public function __toString(): string
52
            {
53
                return 'stringable_security';
×
54
            }
55
        };
×
NEW
56
        $stringableSecurityPostDenormalize = new class implements \Stringable {
×
57
            public function __toString(): string
58
            {
59
                return 'stringable_security_post_denormalize';
×
60
            }
61
        };
×
NEW
62
        $stringableSecurityPostValidation = new class implements \Stringable {
×
63
            public function __toString(): string
64
            {
65
                return 'stringable_security_post_validation';
×
66
            }
67
        };
×
68
        $args = [
×
69
            'security' => $stringableSecurity,
×
70
            'securityPostDenormalize' => $stringableSecurityPostDenormalize,
×
71
            'securityPostValidation' => $stringableSecurityPostValidation,
×
72
        ];
×
73

74
        yield [new Get(...$args)];
×
75
        yield [new GetCollection(...$args)];
×
76
        yield [new Post(...$args)];
×
77
        yield [new Put(...$args)];
×
78
        yield [new Patch(...$args)];
×
79
        yield [new Delete(...$args)];
×
80
        yield [new Error(...$args)];
×
81
        yield [new NotExposed(...$args)];
×
82
        yield [new Query(...$args)];
×
83
        yield [new QueryCollection(...$args)];
×
84
        yield [new Mutation(...$args)];
×
85
        yield [new Subscription(...$args)];
×
86
        yield [new ApiResource(...$args)];
×
87
        yield [new ErrorResource(...$args)];
×
88
        yield [new RestfulApi(...$args)];
×
89
    }
90

91
    public function testOnApiProperty(): void
92
    {
NEW
93
        $stringableSecurity = new class implements \Stringable {
×
94
            public function __toString(): string
95
            {
96
                return 'stringable_security';
×
97
            }
98
        };
×
NEW
99
        $stringableSecurityPostDenormalize = new class implements \Stringable {
×
100
            public function __toString(): string
101
            {
102
                return 'stringable_security_post_denormalize';
×
103
            }
104
        };
×
105

106
        $metadata = new ApiProperty(
×
107
            security: $stringableSecurity,
×
108
            securityPostDenormalize: $stringableSecurityPostDenormalize,
×
109
        );
×
110

111
        $this->assertSame($metadata->getSecurity(), 'stringable_security');
×
112
        $this->assertSame($metadata->getSecurityPostDenormalize(), 'stringable_security_post_denormalize');
×
113
    }
114
}
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