<commit_before><?php

use Collect\Collection;

class CollectionTest extends PHPUnit_Framework_TestCase
{
    public function testProvider()
    {
        $generator = function () {
            yield 'foo';
            yield 'bar';
        };

        return [
            [['foo', 'bar']],
            [new ArrayIterator(['foo', 'bar'])],
            [$generator()],
            [$generator],
        ];
    }

    /**
     * @dataProvider testProvider
     */
    public function testCreation($data)
    {
        $collection = new Collection($data);

        $this->assertEquals('foo', $collection->first());
    }

    /**
     * @dataProvider testProvider<commit_msg>Added Unit tests for invalid input into constructor<commit_after><?php

use Collect\Collection;

class CollectionTest extends PHPUnit_Framework_TestCase
{
    public function testProvider()
    {
        $generator = function () {
            yield 'foo';
            yield 'bar';
        };

        return [
            [['foo', 'bar']],
            [new ArrayIterator(['foo', 'bar'])],
            [$generator()],
            [$generator],
        ];
    }

    /**
     * @dataProvider testProvider
     */
    public function testCreation($data)
    {
        $collection = new Collection($data);

        $this->assertEquals('foo', $collection->first());
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testThrowsExceptionOnScalarData()
    {
        $collection = new Collection(1);
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testThrowsExceptionOnNoneGeneratorClosure()
    {
        $collection = new Collection(function () {
            return 2;
        });
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testThrowsExceptionOnNoneTraversibleObject()
    {
        $collection = new Collection((object) []);
    }

    /**
     * @dataProvider testProvider
{'fraction_non_alphanumeric': 0.12676767676767678, 'fraction_numerical': 0.00101010101010101, 'mean_word_length': 2.052388289676425, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1970685', 'n_tokens_mistral': 512, 'n_tokens_neox': 492, 'n_words': 104}