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

api-platform / core / 13586767090

28 Feb 2025 11:01AM UTC coverage: 8.519% (+0.003%) from 8.516%
13586767090

Pull #6990

github

web-flow
Merge 3b0a00330 into 79fd1eb7e
Pull Request #6990: Merge 4.0

12 of 49 new or added lines in 6 files covered. (24.49%)

2 existing lines in 2 files now uncovered.

13377 of 157029 relevant lines covered (8.52%)

22.89 hits per line

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

0.0
/src/Laravel/Tests/ApiTest.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
use ApiPlatform\Laravel\Test\ApiTestAssertionsTrait;
15
use Illuminate\Contracts\Config\Repository;
16
use Illuminate\Foundation\Application;
17
use Illuminate\Foundation\Testing\RefreshDatabase;
18
use Orchestra\Testbench\Concerns\WithWorkbench;
19
use Orchestra\Testbench\TestCase;
20

21
class ApiTest extends TestCase
22
{
23
    use ApiTestAssertionsTrait;
24
    use RefreshDatabase;
25
    use WithWorkbench;
26

27
    /**
28
     * @param Application $app
29
     */
30
    protected function defineEnvironment($app): void
31
    {
32
        tap($app['config'], function (Repository $config): void {
×
33
            $config->set('api-platform.routes.domain', 'http://test.com');
×
34
            $config->set('app.debug', true);
×
35
            $config->set('api-platform.formats', ['jsonld' => ['application/ld+json']]);
×
36
            $config->set('api-platform.docs_formats', ['jsonld' => ['application/ld+json']]);
×
37
        });
×
38
    }
39

40
    public function testDomainCanBeSet(): void
41
    {
42
        $response = $this->get('http://foobar.com/api/', ['accept' => ['application/ld+json']]);
×
43
        $response->assertNotFound();
×
44

45
        $response = $this->get('http://test.com/api/', ['accept' => ['application/ld+json']]);
×
46
        $response->assertSuccessful();
×
47
    }
48

49
    public function testPrefixedOperations(): void
50
    {
NEW
51
        $response = $this->post('http://test.com/billing/calculate', [], ['content-type' => ['application/ld+json']]);
×
NEW
52
        $response->assertSuccessful();
×
53

NEW
54
        $response = $this->post('http://test.com/shipping/calculate', [], ['content-type' => ['application/ld+json']]);
×
NEW
55
        $response->assertSuccessful();
×
56
    }
57
}
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