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

api-platform / core / 15973247443

30 Jun 2025 12:44PM UTC coverage: 22.065% (+0.001%) from 22.064%
15973247443

push

github

web-flow
chore: use treat phpdoc type as certain (#7250)

8 of 16 new or added lines in 13 files covered. (50.0%)

123 existing lines in 11 files now uncovered.

11518 of 52201 relevant lines covered (22.06%)

22.04 hits per line

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

0.0
/src/Metadata/Tests/Resource/OperationTest.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\CollectionOperationInterface;
17
use ApiPlatform\Metadata\Delete;
18
use ApiPlatform\Metadata\Get;
19
use ApiPlatform\Metadata\GetCollection;
20
use ApiPlatform\Metadata\GraphQl\Mutation;
21
use ApiPlatform\Metadata\GraphQl\Query;
22
use ApiPlatform\Metadata\GraphQl\QueryCollection;
23
use ApiPlatform\Metadata\GraphQl\Subscription;
24
use ApiPlatform\Metadata\HttpOperation;
25
use ApiPlatform\Metadata\Operation;
26
use ApiPlatform\Metadata\Patch;
27
use ApiPlatform\Metadata\Post;
28
use ApiPlatform\Metadata\Put;
29
use PHPUnit\Framework\TestCase;
30

31
final class OperationTest extends TestCase
32
{
33
    public function testWithResourceTrait(): void
34
    {
35
        $operation = (new GetCollection())->withOperation((new HttpOperation())->withShortName('test')->withRead(false));
×
36

37
        $this->assertSame($operation->getShortName(), 'test');
×
38
        $this->assertSame($operation->canRead(), false);
×
NEW
39
        $this->assertInstanceOf(CollectionOperationInterface::class, $operation);
×
40
    }
41

42
    #[\PHPUnit\Framework\Attributes\DataProvider('operationProvider')]
43
    public function testOperationConstructor(Operation $operation): void
44
    {
45
        $this->assertInstanceOf(Operation::class, $operation);
×
46
    }
47

48
    public static function operationProvider(): \Generator
49
    {
50
        $args = [];
×
51

52
        yield [new Get(...$args)];
×
53
        yield [new GetCollection(...$args)];
×
54
        yield [new Post(...$args)];
×
55
        yield [new Put(...$args)];
×
56
        yield [new Patch(...$args)];
×
57
        yield [new Delete(...$args)];
×
58
        yield [new Query(...$args)];
×
59
        yield [new QueryCollection(...$args)];
×
60
        yield [new Mutation(...$args)];
×
61
        yield [new Subscription(...$args)];
×
62
    }
63
}
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

© 2026 Coveralls, Inc