<commit_before><?php

namespace spec\Fungku\HubSpot\Api;

use Fungku\HubSpot\Http\Client;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class ContactsSpec extends ObjectBehavior
{
    private $client;

    private $apiKey = 'demo';

    private $baseUrl = 'https://api.hubapi.com';

    private $headers = [
        'User-Agent' => 'Fungku_HubSpot_PHP/0.9 (https://github.com/fungku/hubspot-php)',
    ];

    private function getUrl($endpoint)
    {
        return $this->baseUrl . $endpoint . '?hapikey=' . $this->apiKey;
    }

    function let(Client $client)
    {
        $this->client = $client;
        $this->beConstructedWith($this->apiKey, $this->client);
    }

    function it_is_initializable()
    {
        $this->shouldHaveType('Fungku\HubSpot\Api\Contacts');
    }

    function it_makes_create_request()
    {
        $contact = ['email' => '<EMAIL>'];

        $this->client->post(self::getUrl('/contacts/v1/contact'), [
            'json'    => $contact,
            'headers' => $this->headers,
        ])->shouldBeCalled();

        $this->create($contact);
    }

    function it_makes_an_update_request()
    {
        $contact = ['email' => '<EMAIL>'];
        $id = 1;

        $this->client->post(self::getUrl("/contacts/v1/contact/vid/{$id}/profile"), [
            'json'    => $contact,<commit_msg>fix ContactsSpec<commit_after><?php

namespace spec\Fungku\HubSpot\Api;

use Fungku\HubSpot\Http\Client;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class ContactsSpec extends ObjectBehavior
{
    private $client;

    private $apiKey = 'demo';

    private $baseUrl = 'https://api.hubapi.com';

    private $headers = [
        'User-Agent' => 'Fungku_HubSpot_PHP/0.9 (https://github.com/fungku/hubspot-php)',
    ];

    private function getUrl($endpoint)
    {
        return $this->baseUrl . $endpoint . '?hapikey=' . $this->apiKey;
    }

    function let(Client $client)
    {
        $this->client = $client;
        $this->beConstructedWith($this->apiKey, $this->client);
    }

    function it_is_initializable()
    {
        $this->shouldHaveType('Fungku\HubSpot\Api\Contacts');
    }

    function it_makes_create_request()
    {
        $contact = ['email' => '<EMAIL>'];

        $this->client->post(self::getUrl('/contacts/v1/contact'), [
            'json'    => ['properties' => $contact],
            'headers' => $this->headers,
        ])->shouldBeCalled();

        $this->create($contact);
    }

    function it_makes_an_update_request()
    {
        $contact = ['email' => '<EMAIL>'];
        $id = 1;

        $this->client->post(self::getUrl("/contacts/v1/contact/vid/{$id}/profile"), [
            'json'    => ['properties' => $contact],
{'fraction_non_alphanumeric': 0.17275747508305647, 'fraction_numerical': 0.0036913990402362494, 'mean_word_length': 2.603723404255319, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 49, 'https://': 4, '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': '4726653', 'n_tokens_mistral': 920, 'n_tokens_neox': 887, 'n_words': 134}