Issues (867)

blog-api/tests/Acceptance/SiteCest.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Tests\Acceptance;
6
7
use App\Tests\Support\AcceptanceTester;
8
use Codeception\Util\HttpCode;
0 ignored issues
show
The type Codeception\Util\HttpCode was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
final class SiteCest
11
{
12
    public function getHome(AcceptanceTester $I): void
13
    {
14
        $I->sendGET('/');
15
        $I->seeResponseCodeIs(HttpCode::OK);
16
        $I->seeResponseIsJson();
17
        $I->seeResponseContainsJson(
18
            [
19
                'status' => 'success',
20
                'error_message' => '',
21
                'error_code' => null,
22
                'data' => [
23
                    'version' => '3.0',
24
                    'author' => 'yiisoft',
25
                ],
26
            ]
27
        );
28
    }
29
30
    public function testNotFoundPage(AcceptanceTester $I): void
31
    {
32
        $I->sendGET('/not_found_page');
33
        $I->seeResponseCodeIs(HttpCode::NOT_FOUND);
34
        $I->seeResponseIsJson();
35
        $I->seeResponseContainsJson(
36
            [
37
                'status' => 'failed',
38
                'error_message' => 'Page not found',
39
                'error_code' => 404,
40
                'data' => null,
41
            ]
42
        );
43
    }
44
45
    public function testNotFoundPageRu(AcceptanceTester $I): void
46
    {
47
        $I->sendGET('/ru/not_found_page');
48
        $I->seeResponseCodeIs(HttpCode::NOT_FOUND);
49
        $I->seeResponseIsJson();
50
        $I->seeResponseContainsJson(
51
            [
52
                'status' => 'failed',
53
                'error_message' => 'Страница не найдена',
54
                'error_code' => 404,
55
                'data' => null,
56
            ]
57
        );
58
    }
59
}
60