<commit_before><?php

namespace Laravie\Webhook\Tests;

use Laravie\Webhook\Client;
use Laravie\Webhook\Request;
use PHPUnit\Framework\TestCase;
use Laravie\Codex\Testing\Faker;

class ClientTest extends TestCase
{
    /** @test */
    public function it_has_proper_signature()
    {
        $stub = new Client(Faker::create()->http());

        $this->assertInstanceOf(Client::class, $stub);
        $this->assertSame('application/json', $stub->getContentType());
    }

    /** @test */
    public function it_can_set_custom_content_type()
    {
        $stub = new Client(Faker::create()->http());
        $stub->setContentType('application/xml');

        $this->assertSame('application/xml', $stub->getContentType());
    }

        /** @test */
    public function it_can_send_api_request_on_version_one()
    {
        $faker = Faker::create()
                    ->sendJson('POST', [], ['foo' => 'bar'])
                    ->expectEndpointIs('https://acme.laravie/webhook')
                    ->shouldResponseWith(200, 'OK');

        $request = new class() extends Request {
            public function ping()
            {
                return $this->send('https://acme.laravie/webhook', [], ['foo' => 'bar']);
            }
        };

        $client = new Client($faker->http());

        $response = $client->via($request)->ping();

        $this->assertSame(200, $response->getStatusCode());
        $this->assertSame('OK', $response->getBody());
    }
}<commit_msg>Update tests.<commit_after><?php

namespace Laravie\Webhook\Tests;

use Laravie\Webhook\Client;
use Laravie\Webhook\Request;
use PHPUnit\Framework\TestCase;
use Laravie\Codex\Testing\Faker;

class ClientTest extends TestCase
{
    /** @test */
    public function it_has_proper_signature()
    {
        $stub = new Client(Faker::create()->http());

        $this->assertInstanceOf(Client::class, $stub);
        $this->assertSame('application/json', $stub->getContentType());
    }

    /** @test */
    public function it_can_set_custom_content_type()
    {
        $stub = new Client(Faker::create()->http());
        $stub->setContentType('application/xml');

        $this->assertSame('application/xml', $stub->getContentType());
    }

        /** @test */
    public function it_can_send_api_request_on_version_one()
    {
        $faker = Faker::create()
                    ->sendJson('POST', [], ['foo' => 'bar'])
                    ->expectEndpointIs('https://acme.laravie/webhook')
                    ->shouldResponseWith(200, 'OK');

        $request = new class() extends Request {
            public function ping()
            {
                return $this->send(
                    'https://acme.laravie/webhook', $this->mergeWebhookHeaders([]), $this->mergeWebhookBody(['foo' => 'bar'])
                );
            }
        };

        $client = new Client($faker->http());

        $response = $client->via($request)->ping();

        $this->assertSame(200, $response->getStatusCode());
        $this->assertSame('OK', $response->getBody());
    }
}
{'fraction_non_alphanumeric': 0.170859196341065, 'fraction_numerical': 0.003920287487749101, 'mean_word_length': 2.452085682074408, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '5590867', 'n_tokens_mistral': 923, 'n_tokens_neox': 899, 'n_words': 141}