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

api-platform / core / 10618078048

29 Aug 2024 03:28PM UTC coverage: 7.687% (-0.003%) from 7.69%
10618078048

push

github

web-flow
fix(laravel): cache metadata, add trace on debug mode (#6555)

0 of 143 new or added lines in 8 files covered. (0.0%)

3 existing lines in 1 file now uncovered.

12488 of 162451 relevant lines covered (7.69%)

22.92 hits per line

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

0.0
/src/Laravel/Tests/JsonProblemTest.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\Laravel\Tests;
15

16
use Illuminate\Foundation\Application;
17
use Illuminate\Foundation\Testing\RefreshDatabase;
18
use Orchestra\Testbench\Attributes\DefineEnvironment;
19
use Orchestra\Testbench\Concerns\WithWorkbench;
20
use Orchestra\Testbench\TestCase;
21

22
class JsonProblemTest extends TestCase
23
{
24
    use RefreshDatabase;
25
    use WithWorkbench;
26

27
    public function testNotFound(): void
28
    {
29
        $response = $this->get('/api/books/notfound');
×
30
        $response->assertStatus(404);
×
31
        $response->assertHeader('content-type', 'application/problem+json; charset=utf-8');
×
32
        $response->assertJsonFragment([
×
33
            '@context' => '/api/contexts/Error',
×
34
            '@id' => '/api/errors/404.jsonld',
×
35
            '@type' => 'hydra:Error',
×
36
            'type' => '/errors/404',
×
37
            'title' => 'An error occurred',
×
38
            'status' => 404,
×
39
            'detail' => 'Not Found',
×
40
        ]);
×
41
    }
42

43
    /**
44
     * @param Application $app
45
     */
46
    protected function useProductionMode($app): void
47
    {
NEW
48
        $app['config']->set('app.debug', false);
×
49
    }
50

51
    #[DefineEnvironment('useProductionMode')]
52
    public function testProductionError(): void
53
    {
NEW
54
        $response = $this->post('/api/books', ['content-type' => 'application/vnd.api+json']);
×
NEW
55
        $response->assertStatus(415);
×
NEW
56
        $content = $response->json();
×
NEW
57
        $this->assertArrayNotHasKey('trace', $content);
×
NEW
58
        $this->assertArrayNotHasKey('line', $content);
×
NEW
59
        $this->assertArrayNotHasKey('file', $content);
×
60
    }
61
}
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