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

api-platform / core / 14966772795

12 May 2025 07:51AM UTC coverage: 8.418% (+0.02%) from 8.396%
14966772795

push

github

soyuka
!fix(openapi): allowReserved, allowEmtpyValue defaults to null

45 of 75 new or added lines in 3 files covered. (60.0%)

591 existing lines in 8 files now uncovered.

13484 of 160174 relevant lines covered (8.42%)

22.88 hits per line

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

0.0
/tests/Fixtures/TestBundle/Entity/SearchFilterParameter.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\Tests\Fixtures\TestBundle\Entity;
15

16
use ApiPlatform\Metadata\ApiFilter;
17
use ApiPlatform\Metadata\ApiResource;
18
use ApiPlatform\Metadata\GetCollection;
19
use ApiPlatform\Metadata\GraphQl\QueryCollection;
20
use ApiPlatform\Metadata\QueryParameter;
21
use ApiPlatform\Tests\Fixtures\TestBundle\Filter\QueryParameterFilter;
22
use ApiPlatform\Tests\Fixtures\TestBundle\Filter\SearchFilterValueTransformer;
23
use ApiPlatform\Tests\Fixtures\TestBundle\Filter\SearchTextAndDateFilter;
24
use Doctrine\ORM\Mapping as ORM;
25

26
#[ApiResource(openapi: false)]
27
#[GetCollection(
28
    uriTemplate: 'search_filter_parameter{._format}',
×
29
    parameters: [
×
30
        'foo' => new QueryParameter(filter: 'app_search_filter_via_parameter'),
×
UNCOV
31
        'fooAlias' => new QueryParameter(filter: 'app_search_filter_via_parameter', property: 'foo'),
×
32
        'order[:property]' => new QueryParameter(filter: 'app_search_filter_via_parameter.order_filter'),
×
33

34
        'searchPartial[:property]' => new QueryParameter(filter: 'app_search_filter_partial'),
×
35
        'searchExact[:property]' => new QueryParameter(filter: 'app_search_filter_with_exact'),
×
36
        'searchOnTextAndDate[:property]' => new QueryParameter(filter: 'app_filter_date_and_search'),
×
37
        'q' => new QueryParameter(property: 'hydra:freetextQuery'),
×
UNCOV
38
    ]
×
39
)]
×
40
#[QueryCollection(
41
    parameters: [
×
UNCOV
42
        'foo' => new QueryParameter(filter: 'app_search_filter_via_parameter'),
×
43
        'order[:property]' => new QueryParameter(filter: 'app_search_filter_via_parameter.order_filter'),
×
44

45
        'searchPartial[:property]' => new QueryParameter(filter: 'app_search_filter_partial'),
×
46
        'searchExact[:property]' => new QueryParameter(filter: 'app_search_filter_with_exact'),
×
47
        'searchOnTextAndDate[:property]' => new QueryParameter(filter: 'app_filter_date_and_search'),
×
48
        'q' => new QueryParameter(property: 'hydra:freetextQuery'),
×
UNCOV
49
    ]
×
UNCOV
50
)]
×
51
#[ApiFilter(SearchFilterValueTransformer::class, alias: 'app_search_filter_partial', properties: ['foo' => 'partial'], arguments: ['key' => 'searchPartial'])]
52
#[ApiFilter(SearchFilterValueTransformer::class, alias: 'app_search_filter_with_exact', properties: ['foo' => 'exact'], arguments: ['key' => 'searchExact'])]
53
#[ApiFilter(SearchTextAndDateFilter::class, alias: 'app_filter_date_and_search', properties: ['foo', 'createdAt'], arguments: ['dateFilterProperties' => ['createdAt' => 'exclude_null'], 'searchFilterProperties' => ['foo' => 'exact']])]
54
#[QueryParameter(key: ':property', filter: QueryParameterFilter::class)]
55
#[ORM\Entity]
56
class SearchFilterParameter
57
{
58
    /**
59
     * @var int The id
60
     */
61
    #[ORM\Column(type: 'integer')]
62
    #[ORM\Id]
63
    #[ORM\GeneratedValue(strategy: 'AUTO')]
64
    private ?int $id = null;
65
    #[ORM\Column(type: 'string')]
66
    private string $foo = '';
67

68
    #[ORM\Column(type: 'datetime_immutable', nullable: true)]
69
    private ?\DateTimeImmutable $createdAt = null;
70

71
    public function getId(): ?int
72
    {
UNCOV
73
        return $this->id;
×
74
    }
75

76
    public function getFoo(): string
77
    {
UNCOV
78
        return $this->foo;
×
79
    }
80

81
    public function setFoo(string $foo): void
82
    {
UNCOV
83
        $this->foo = $foo;
×
84
    }
85

86
    public function getCreatedAt(): ?\DateTimeImmutable
87
    {
UNCOV
88
        return $this->createdAt;
×
89
    }
90

91
    public function setCreatedAt(\DateTimeImmutable $createdAt): void
92
    {
UNCOV
93
        $this->createdAt = $createdAt;
×
94
    }
95
}
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