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

api-platform / core / 10884379752

16 Sep 2024 01:01PM UTC coverage: 7.281% (-0.4%) from 7.672%
10884379752

push

github

soyuka
Merge 3.4

0 of 100 new or added lines in 7 files covered. (0.0%)

5332 existing lines in 181 files now uncovered.

11994 of 164725 relevant lines covered (7.28%)

9.52 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\GetCollection;
18
use ApiPlatform\Metadata\GraphQl\QueryCollection;
19
use ApiPlatform\Metadata\QueryParameter;
20
use ApiPlatform\Tests\Fixtures\TestBundle\Filter\QueryParameterFilter;
21
use ApiPlatform\Tests\Fixtures\TestBundle\Filter\SearchFilterValueTransformer;
22
use ApiPlatform\Tests\Fixtures\TestBundle\Filter\SearchTextAndDateFilter;
23
use Doctrine\ORM\Mapping as ORM;
24

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

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

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

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

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

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

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

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

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