<commit_before><?php

namespace spec\App\Users\Controller;

use App\Users\Controller\PostController;
use App\Users\Entity\UserFactory;
use App\Users\Repository\UserRepository;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Tests\Gateway\FakeGateway;

class PostControllerSpec extends ObjectBehavior
{
    const NAME = 'Some task description';
    const EMAIL = '<EMAIL>';
    const PASS = '<PASSWORD>';

    private $dispatcher;

    private $repository;

    function let()
    {
        $this->dispatcher = new EventDispatcher();
        $this->repository = new UserRepository(
            new UserFactory(),
            new FakeGateway()
        );
    }

    function it_can_create_new_task_giving_a_username_email_and_password()
    {
        $this->beConstructedWith(
            $this->dispatcher,
            $this->repository
        );

        $request = new Request();
        $request->request->add(['username' => self::NAME]);
        $request->request->add(['email' => self::EMAIL]);
        $request->request->add(['password' => self::PASS]);

        $response  =$this->postAction($request);
        $response->shouldBeAnInstanceOf(JsonResponse::class);
        $response->getStatusCode()->shouldBe(204);
    }

}<commit_msg>Test empty values at User PostConttroller<commit_after><?php

namespace spec\App\Users\Controller;

use App\Users\Controller\PostController;
use App\Users\Entity\UserFactory;
use App\Users\Repository\UserRepository;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Tests\Gateway\FakeGateway;

class PostControllerSpec extends ObjectBehavior
{
    const NAME = 'Some task description';
    const EMAIL = '<EMAIL>';
    const PASS = '<PASSWORD>';

    private $dispatcher;

    private $repository;

    function let()
    {
        $this->dispatcher = new EventDispatcher();
        $this->repository = new UserRepository(
            new UserFactory(),
            new FakeGateway()
        );
    }

    function it_can_create_new_task_giving_a_username_email_and_password()
    {
        $this->beConstructedWith(
            $this->dispatcher,
            $this->repository
        );

        $request = new Request();
        $request->request->add(['username' => self::NAME]);
        $request->request->add(['email' => self::EMAIL]);
        $request->request->add(['password' => self::PASS]);

        $response  =$this->postAction($request);
        $response->shouldBeAnInstanceOf(JsonResponse::class);
        $response->getStatusCode()->shouldBe(204);
    }

    function it_must_have_username()
    {
        $this->beConstructedWith(
            $this->dispatcher,
            $this->repository
        );

        $request = new Request();
        $request->request->add(['email' => self::EMAIL]);
        $request->request->add(['password' => self::PASS]);

        $this->postAction($request)->shouldBeAnInstanceOf(JsonResponse::class);

        $response = $this->postAction($request);

        $response->getStatusCode()->shouldBe(400);
    }

    function it_must_have_email()
    {
        $this->beConstructedWith(
            $this->dispatcher,
            $this->repository
        );

        $request = new Request();
        $request->request->add(['username' => self::NAME]);
        $request->request->add(['password' => self::PASS]);

        $this->postAction($request)->shouldBeAnInstanceOf(JsonResponse::class);

        $response = $this->postAction($request);

        $response->getStatusCode()->shouldBe(400);
    }


    function it_must_have_password()
    {
        $this->beConstructedWith(
            $this->dispatcher,
            $this->repository
        );

        $request = new Request();
        $request->request->add(['username' => self::NAME]);
        $request->request->add(['email' => self::EMAIL]);

        $this->postAction($request)->shouldBeAnInstanceOf(JsonResponse::class);

        $response = $this->postAction($request);

        $response->getStatusCode()->shouldBe(400);
    }
}
{'fraction_non_alphanumeric': 0.1444160668678895, 'fraction_numerical': 0.003482702577199907, 'mean_word_length': 3.003717472118959, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 85, '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': '818754', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1180, 'n_words': 193}