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

api-platform / core / 10739011304

06 Sep 2024 01:11PM UTC coverage: 7.159% (-0.5%) from 7.645%
10739011304

push

github

web-flow
 feat(laravel): eloquent filters (search, date, equals, or) (#6593)

* feat(laravel): Eloquent filters search date or

* feat(laravel): eloquent filters order range equals afterdate

* fix(laravel): order afterDate filters

* temp

* test(laravel): filter with eloquent

---------

Co-authored-by: Nathan <nathan@les-tilleuls.coop>

0 of 144 new or added lines in 16 files covered. (0.0%)

4792 existing lines in 155 files now uncovered.

11736 of 163930 relevant lines covered (7.16%)

22.8 hits per line

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

0.0
/src/Metadata/Tests/Resource/Factory/ParameterResourceMetadataCollectionFactoryTests.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\Factory;
15

16
use ApiPlatform\Metadata\FilterInterface;
17
use ApiPlatform\Metadata\Parameters;
18
use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
19
use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
20
use ApiPlatform\Metadata\QueryParameter;
21
use ApiPlatform\Metadata\Resource\Factory\AttributesResourceMetadataCollectionFactory;
22
use ApiPlatform\Metadata\Resource\Factory\ParameterResourceMetadataCollectionFactory;
23
use ApiPlatform\Metadata\Tests\Fixtures\ApiResource\WithParameter;
24
use ApiPlatform\OpenApi\Model\Parameter;
25
use PHPUnit\Framework\TestCase;
26
use Psr\Container\ContainerInterface;
27

28
class ParameterResourceMetadataCollectionFactoryTests extends TestCase
29
{
30
    public function testParameterFactory(): void
31
    {
32
        $nameCollection = $this->createStub(PropertyNameCollectionFactoryInterface::class);
×
NEW
33
        $propertyMetadata = $this->createStub(PropertyMetadataFactoryInterface::class);
×
34
        $filterLocator = $this->createStub(ContainerInterface::class);
×
35
        $filterLocator->method('has')->willReturn(true);
×
36
        $filterLocator->method('get')->willReturn(new class implements FilterInterface {
×
37
            public function getDescription(string $resourceClass): array
38
            {
39
                return [
×
40
                    'hydra' => [
×
41
                        'property' => 'hydra',
×
42
                        'type' => 'string',
×
43
                        'required' => false,
×
44
                        'schema' => ['type' => 'foo'],
×
45
                        'openapi' => new Parameter('test', 'query'),
×
46
                    ],
×
47
                    'everywhere' => [
×
48
                        'property' => 'everywhere',
×
49
                        'type' => 'string',
×
50
                        'required' => false,
×
51
                        'openapi' => ['allowEmptyValue' => true]],
×
52
                ];
×
53
            }
54
        });
×
NEW
55
        $parameter = new ParameterResourceMetadataCollectionFactory(
×
NEW
56
            $nameCollection,
×
NEW
57
            $propertyMetadata,
×
NEW
58
            new AttributesResourceMetadataCollectionFactory(),
×
NEW
59
            $filterLocator
×
NEW
60
        );
×
61
        $operation = $parameter->create(WithParameter::class)->getOperation('collection');
×
62
        $this->assertInstanceOf(Parameters::class, $parameters = $operation->getParameters());
×
63
        $hydraParameter = $parameters->get('hydra', QueryParameter::class);
×
64
        $this->assertEquals(['type' => 'foo'], $hydraParameter->getSchema());
×
65
        $this->assertEquals(new Parameter('test', 'query'), $hydraParameter->getOpenApi());
×
66
        $everywhere = $parameters->get('everywhere', QueryParameter::class);
×
67
        $this->assertEquals(new Parameter('everywhere', 'query', allowEmptyValue: true), $everywhere->getOpenApi());
×
68
    }
69
}
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