• 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/Resolver/Factory/ResolverFactoryTest.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\Resolver\Factory;
15

16
use ApiPlatform\GraphQl\Resolver\Factory\ResolverFactory;
17
use ApiPlatform\Metadata\GraphQl\Mutation;
18
use ApiPlatform\Metadata\GraphQl\Operation;
19
use ApiPlatform\Metadata\GraphQl\Query;
20
use ApiPlatform\State\ProcessorInterface;
21
use ApiPlatform\State\ProviderInterface;
22
use GraphQL\Type\Definition\ResolveInfo;
23
use PHPUnit\Framework\TestCase;
24

25
class ResolverFactoryTest extends TestCase
26
{
27
    /**
28
     * @dataProvider graphQlQueries
29
     */
30
    public function testGraphQlResolver(string $resourceClass = null, string $rootClass = null, Operation $operation = null, Operation $providedOperation = null, Operation $processedOperation = null): void
31
    {
32
        $returnValue = new \stdClass();
×
33
        $body = new \stdClass();
×
34
        $context = $this->logicalAnd(
×
35
            $this->arrayHasKey('source'), $this->arrayHasKey('args'), $this->arrayHasKey('graphql_context'), $this->arrayHasKey('info'), $this->arrayHasKey('root_class')
×
36
        );
×
37
        $provider = $this->createMock(ProviderInterface::class);
×
38
        $provider->expects($this->once())->method('provide')->with($providedOperation ?: $operation, [], $context)->willReturn($body);
×
39
        $processor = $this->createMock(ProcessorInterface::class);
×
40
        $processor->expects($this->once())->method('process')->with($body, $processedOperation ?: $operation, [], $context)->willReturn($returnValue);
×
41
        $resolveInfo = $this->createMock(ResolveInfo::class);
×
42
        $resolveInfo->fieldName = 'test';
×
43

44
        $resolverFactory = new ResolverFactory($provider, $processor);
×
45
        $this->assertEquals($resolverFactory->__invoke($resourceClass, $rootClass, $operation)(['test' => null], [], [], $resolveInfo), $returnValue);
×
46
    }
47

48
    public function graphQlQueries(): array
49
    {
50
        return [
×
51
            ['Dummy', 'Dummy', new Query()],
×
52
            ['Dummy', 'Dummy', new Mutation(), (new Mutation())->withValidate(true), (new Mutation())->withValidate(true)->withWrite(true)],
×
53
        ];
×
54
    }
55
}
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