<commit_before><?php declare(strict_types=1);

namespace Simplex\Quickstart\Module\Demo\Test\Functional;

use Simplex\Quickstart\Module\Demo\DataFixture\PersonLoader;
use Simplex\Quickstart\Shared\Testing\FunctionalTest;

class PersonApiTest extends FunctionalTest
{
    public function test_it_can_be_queried_for_a_list_of_people()
    {
        $response = $this->sendGet('/');

        $body = $this->getBody($response);

        self::assertCount(1, $body);
        self::assertJsonDocumentMatchesSchema(json_encode($body[0]),
            [
                '$.name' => '<NAME>',
                '$.email' => '<EMAIL>',
            ]
        );
    }

    public function test_it_can_be_queried_for_a_specific_person()
    {
        $response = $this->sendGet('/person/' . PersonLoader::PERSON_1_ID);

        self::assertMessageBodyMatchesJson($response,
            [
                '$.name' => '<NAME>',
                '$.email' => '<EMAIL>'
            ]
        );

        self::assertJsonDocumentMatchesSchema($this->getRawBody($response),
            [
                'type'       => 'object',
                'required'   => ['name', 'email', '_links'],
                'properties' => [
                    'name' => ['type' => 'string'],
                    'email' => ['type' => 'string'],
                    'links' => ['type' => 'array'],
                ]
            ]
        );
    }

    public function test_it_can_create_a_new_person()
    {
        $response = $this->sendPost('/person',
            [
                'name' => 'Will',
                'email' => '<EMAIL>',
                'password' => '<PASSWORD>'
            ]
        );

        self::assertResponseHasStatus($response, 201);
        self::assertMessageHasHeader($response, 'Location');
    }
}<commit_msg>Updated test to use http status code constant<commit_after><?php declare(strict_types=1);

namespace Simplex\Quickstart\Module\Demo\Test\Functional;

use Lukasoppermann\Httpstatus\Httpstatuscodes;
use Simplex\Quickstart\Module\Demo\DataFixture\PersonLoader;
use Simplex\Quickstart\Shared\Testing\FunctionalTest;

class PersonApiTest extends FunctionalTest
{
    public function test_it_can_be_queried_for_a_list_of_people()
    {
        $response = $this->sendGet('/');

        $body = $this->getBody($response);

        self::assertCount(1, $body);
        self::assertJsonDocumentMatchesSchema(json_encode($body[0]),
            [
                '$.name' => '<NAME>',
                '$.email' => '<EMAIL>',
            ]
        );
    }

    public function test_it_can_be_queried_for_a_specific_person()
    {
        $response = $this->sendGet('/person/' . PersonLoader::PERSON_1_ID);

        self::assertMessageBodyMatchesJson($response,
            [
                '$.name' => '<NAME>',
                '$.email' => '<EMAIL>'
            ]
        );

        self::assertJsonDocumentMatchesSchema($this->getRawBody($response),
            [
                'type'       => 'object',
                'required'   => ['name', 'email', '_links'],
                'properties' => [
                    'name' => ['type' => 'string'],
                    'email' => ['type' => 'string'],
                    'links' => ['type' => 'array'],
                ]
            ]
        );
    }

    public function test_it_can_create_a_new_person()
    {
        $response = $this->sendPost('/person',
            [
                'name' => 'Will',
                'email' => '<EMAIL>',
                'password' => '<PASSWORD>'
            ]
        );

        self::assertResponseHasStatus($response, Httpstatuscodes::HTTP_CREATED);
        self::assertMessageHasHeader($response, 'Location');
    }
}
{'fraction_non_alphanumeric': 0.15299811777359507, 'fraction_numerical': 0.0029577843506318905, 'mean_word_length': 1.8926905132192846, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3514775', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1033, 'n_words': 147}