<commit_before><?php

use Eloquent\Phony as x;

describe('EventEmitter', function () {
    beforeEach(function () {
        $this->emitter = new EventEmitter();

        $this->spyA = x\spy();
        $this->spyB = x\spy();
        $this->spyC = x\spy();
        $this->spyD = x\spy();
    });

    describe('on()', function () {
        it('adds listeners to the correct events', function () {
            $this->emitter->on('eventA', $this->spyA);
            $this->emitter->on('eventB', $this->spyB);
            $this->emitter->on('eventA', $this->spyC);
            $this->emitter->on('eventB', $this->spyD);
            $this->emitter->on('eventA', $this->spyA);

            expect($this->emitter->listeners('eventA'))->to->be->equal(array($this->spyA, $this->spyC, $this->spyA));
            expect($this->emitter->listeners('eventB'))->to->be->equal(array($this->spyB, $this->spyD));
        });
    });

    describe('once()', function () {
        it('only calls the listener once', function () {
            $this->emitter->once('eventA', $this->spyA);

            $this->emitter->emit('eventA', 1, 2);
            $this->emitter->emit('eventA', 3, 4);

            $this->spyA->once()->called();
            $this->spyA->calledWith(1, 2);
        });
    });

    describe('removeListener()', function () {
        it('removes listeners from the correct events', function () {
            $this->emitter->removeListener('no-listeners', function () {});

            $this->emitter->on('eventA', $this->spyA);<commit_msg>Change spec wording. Relates to #84.<commit_after><?php

use Eloquent\Phony as x;

describe('EventEmitter', function () {
    beforeEach(function () {
        $this->emitter = new EventEmitter();

        $this->spyA = x\spy();
        $this->spyB = x\spy();
        $this->spyC = x\spy();
        $this->spyD = x\spy();
    });

    describe('on()', function () {
        it('adds listeners to the correct events', function () {
            $this->emitter->on('eventA', $this->spyA);
            $this->emitter->on('eventB', $this->spyB);
            $this->emitter->on('eventA', $this->spyC);
            $this->emitter->on('eventB', $this->spyD);
            $this->emitter->on('eventA', $this->spyA);

            expect($this->emitter->listeners('eventA'))->to->be->equal(array($this->spyA, $this->spyC, $this->spyA));
            expect($this->emitter->listeners('eventB'))->to->be->equal(array($this->spyB, $this->spyD));
        });
    });

    describe('once()', function () {
        it('removes the listener once it is called', function () {
            $this->emitter->once('eventA', $this->spyA);

            $this->emitter->emit('eventA', 1, 2);
            $this->emitter->emit('eventA', 3, 4);

            $this->spyA->once()->called();
            $this->spyA->calledWith(1, 2);
        });
    });

    describe('removeListener()', function () {
        it('removes listeners from the correct events', function () {
            $this->emitter->removeListener('no-listeners', function () {});

            $this->emitter->on('eventA', $this->spyA);
{'fraction_non_alphanumeric': 0.220754108926845, 'fraction_numerical': 0.0045117628101836935, 'mean_word_length': 2.4412416851441243, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 107, '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': '3518169', 'n_tokens_mistral': 1044, 'n_tokens_neox': 991, 'n_words': 156}