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

api-platform / core / 6067528200

04 Sep 2023 12:12AM UTC coverage: 36.875% (-21.9%) from 58.794%
6067528200

Pull #5791

github

web-flow
Merge 64157e578 into d09cfc9d2
Pull Request #5791: fix: strip down any sql function name

3096 of 3096 new or added lines in 205 files covered. (100.0%)

9926 of 26918 relevant lines covered (36.87%)

6.5 hits per line

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

0.0
/src/GraphQl/Tests/State/Processor/SubscriptionProcessorTest.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\GraphQl\Tests\State\Processor;
15

16
use ApiPlatform\GraphQl\State\Processor\SubscriptionProcessor;
17
use ApiPlatform\GraphQl\Subscription\MercureSubscriptionIriGeneratorInterface;
18
use ApiPlatform\GraphQl\Subscription\SubscriptionManagerInterface;
19
use ApiPlatform\Metadata\GraphQl\Subscription;
20
use ApiPlatform\State\ProcessorInterface;
21
use PHPUnit\Framework\TestCase;
22

23
class SubscriptionProcessorTest extends TestCase
24
{
25
    public function testProcess(): void
26
    {
27
        $operation = new Subscription(mercure: ['hub' => 'mercure.rocks']);
×
28
        $context = [];
×
29
        $decorated = $this->createMock(ProcessorInterface::class);
×
30
        $decorated->expects($this->once())->method('process')->willReturn([]);
×
31
        $subscriptionManager = $this->createMock(SubscriptionManagerInterface::class);
×
32
        $subscriptionManager->expects($this->once())->method('retrieveSubscriptionId')->willReturn('/1');
×
33
        $mercureSubscriptionIriGenerator = $this->createMock(MercureSubscriptionIriGeneratorInterface::class);
×
34
        $mercureSubscriptionIriGenerator->expects($this->once())->method('generateMercureUrl')->with('/1', $operation->getMercure()['hub']);
×
35
        $processor = new SubscriptionProcessor($decorated, $subscriptionManager, $mercureSubscriptionIriGenerator);
×
36
        $processor->process([], $operation, [], $context);
×
37
    }
38

39
    public function testProcessWithoutId(): void
40
    {
41
        $operation = new Subscription(mercure: ['hub' => 'mercure.rocks']);
×
42
        $context = [];
×
43
        $decorated = $this->createMock(ProcessorInterface::class);
×
44
        $decorated->expects($this->once())->method('process')->willReturn([]);
×
45
        $subscriptionManager = $this->createMock(SubscriptionManagerInterface::class);
×
46
        $subscriptionManager->expects($this->once())->method('retrieveSubscriptionId')->willReturn(null);
×
47
        $mercureSubscriptionIriGenerator = $this->createMock(MercureSubscriptionIriGeneratorInterface::class);
×
48
        $mercureSubscriptionIriGenerator->expects($this->never())->method('generateMercureUrl')->with('/1', $operation->getMercure()['hub']);
×
49
        $processor = new SubscriptionProcessor($decorated, $subscriptionManager, $mercureSubscriptionIriGenerator);
×
50
        $processor->process([], $operation, [], $context);
×
51
    }
52

53
    public function testProcessWithoutMercure(): void
54
    {
55
        $operation = new Subscription();
×
56
        $context = [];
×
57
        $decorated = $this->createMock(ProcessorInterface::class);
×
58
        $decorated->expects($this->once())->method('process')->willReturn([]);
×
59
        $subscriptionManager = $this->createMock(SubscriptionManagerInterface::class);
×
60
        $subscriptionManager->expects($this->never())->method('retrieveSubscriptionId')->willReturn(null);
×
61
        $mercureSubscriptionIriGenerator = $this->createMock(MercureSubscriptionIriGeneratorInterface::class);
×
62
        $mercureSubscriptionIriGenerator->expects($this->never())->method('generateMercureUrl');
×
63
        $processor = new SubscriptionProcessor($decorated, $subscriptionManager, $mercureSubscriptionIriGenerator);
×
64
        $processor->process([], $operation, [], $context);
×
65
    }
66
}
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