<commit_before><?php
namespace spec\Nats;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class ConnectionSpec extends ObjectBehavior
{
    function it_is_initializable()
    {
        $this->shouldHaveType('Nats\Connection');
    }

    function it_has_ping_count_to_zero()
    {
        $this->pingsCount()->shouldBe(0);
    }

    function it_has_pubs_count_to_zero()
    {
        $this->pubsCount()->shouldBe(0);
    }

    function it_has_reconnects_count_to_zero()
    {
        $this->reconnectsCount()->shouldBe(0);
    }

    function it_has_subscriptions_count_to_zero()
    {
        $this->subscriptionsCount()->shouldBe(0);
    }

    function it_subscriptions_array_is_empty()
    {
        $this->getSubscriptions()->shouldHaveCount(0);
    }

    function it_is_disconnected()
    {
        $this->isConnected()->shouldBe(false);
    }

    function it_can_connect_and_disconnect_with_default_options()
    {
        $this->connect();
        $this->shouldHaveType('Nats\Connection');
        $this->isConnected()->shouldBe(true);
        $this->close();
        $this->isConnected()->shouldBe(false);
    }
}<commit_msg>check reconnection and ping counts<commit_after><?php
namespace spec\Nats;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class ConnectionSpec extends ObjectBehavior
{
    function it_is_initializable()
    {
        $this->shouldHaveType('Nats\Connection');
    }

    function it_has_ping_count_to_zero()
    {
        $this->pingsCount()->shouldBe(0);
    }

    function it_has_pubs_count_to_zero()
    {
        $this->pubsCount()->shouldBe(0);
    }

    function it_has_reconnects_count_to_zero()
    {
        $this->reconnectsCount()->shouldBe(0);
    }

    function it_has_subscriptions_count_to_zero()
    {
        $this->subscriptionsCount()->shouldBe(0);
    }

    function it_subscriptions_array_is_empty()
    {
        $this->getSubscriptions()->shouldHaveCount(0);
    }

    function it_is_disconnected()
    {
        $this->isConnected()->shouldBe(false);
    }

    function it_can_connect_and_disconnect_with_default_options()
    {
        $this->connect();
        $this->shouldHaveType('Nats\Connection');
        $this->isConnected()->shouldBe(true);
        $this->close();
        $this->isConnected()->shouldBe(false);
    }

    function it_increases_reconnects_count_on_each_reconnection()
    {
        $this->connect();
        $this->reconnect();
        $this->reconnectsCount()->shouldBe(1);
        $this->isConnected()->shouldBe(true);
    }

    function it_a_ping_is_sent_after_a_successful_connection()
    {
        $this->connect();
        $this->pingsCount()->shouldBe(1);
    }
}
{'fraction_non_alphanumeric': 0.13672020918939112, 'fraction_numerical': 0.0044826298094882335, 'mean_word_length': 3.021021021021021, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 52, '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': '4911364', 'n_tokens_mistral': 879, 'n_tokens_neox': 862, 'n_words': 92}