<commit_before><?php

namespace Spatie\SlashCommand\Test;

use Spatie\SlashCommand\Exceptions\InvalidHandler;
use Spatie\SlashCommand\Exceptions\InvalidRequest;
use Spatie\SlashCommand\Exceptions\RequestCouldNotBeHandled;

class ControllerTest extends TestCase
{
    /** @test */
    public function it_throws_an_exception_when_receiving_a_request_without_a_token()
    {
        $this->expectException(InvalidRequest::class);

        $this->call('POST', 'test-url');
    }

    /** @test */
    public function it_throws_an_exception_when_receiving_a_wrong_token()
    {
        $this->expectException(InvalidRequest::class);

        $this->call('POST', 'test-url', ['token' => 'wrong token']);
    }

    /** @test */
    public function it_throws_an_exception_if_no_handler_can_handle_the_request()
    {
        $this->app['config']->set('laravel-slack-slash-command.handlers', []);

        $this->expectException(RequestCouldNotBeHandled::class);

        $this->call('POST', 'test-url', ['token' => 'test-token']);
    }

    /** @test */
    public function it_throws_an_exception_if_an_non_existing_handler_class_is_given()
    {
        $this->app['config']->set('laravel-slack-slash-command.handlers', ['NonExistingClassName']);

        $this->expectException(InvalidHandler::class);

        $this->call('POST', 'test-url', ['token' => 'test-token']);
    }
}<commit_msg>fix test for L5.3<commit_after><?php

namespace Spatie\SlashCommand\Test;

use Spatie\SlashCommand\Exceptions\InvalidHandler;
use Spatie\SlashCommand\Exceptions\InvalidRequest;
use Spatie\SlashCommand\Exceptions\RequestCouldNotBeHandled;

class ControllerTest extends TestCase
{
    /** @test */
    public function it_throws_an_exception_when_receiving_a_request_without_a_token()
    {
        $this->expectException(InvalidRequest::class);

        $this->call('POST', 'test-url');
    }

    /** @test */
    public function it_throws_an_exception_when_receiving_a_wrong_token()
    {
        $this->expectException(InvalidRequest::class);

        $response = $this->call('POST', 'test-url', ['token' => 'wrong token']);

        if (isset($response->exception)) {
            throw $response->exception;
        };
    }

    /** @test */
    public function it_throws_an_exception_if_no_handler_can_handle_the_request()
    {
        $this->app['config']->set('laravel-slack-slash-command.handlers', []);

        $this->expectException(RequestCouldNotBeHandled::class);

        $this->call('POST', 'test-url', ['token' => 'test-token']);
    }

    /** @test */
    public function it_throws_an_exception_if_an_non_existing_handler_class_is_given()
    {
        $this->app['config']->set('laravel-slack-slash-command.handlers', ['NonExistingClassName']);

        $this->expectException(InvalidHandler::class);

        $this->call('POST', 'test-url', ['token' => 'test-token']);
    }
}
{'fraction_non_alphanumeric': 0.1550468262226847, 'fraction_numerical': 0.000693721817551162, 'mean_word_length': 3.888135593220339, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '2726706', 'n_tokens_mistral': 923, 'n_tokens_neox': 894, 'n_words': 110}