<commit_before><?php
/**
 * vipnytt/RobotsTxtParser
 *
 * @link https://github.com/VIPnytt/RobotsTxtParser
 * @license https://github.com/VIPnytt/RobotsTxtParser/blob/master/LICENSE The MIT License (MIT)
 */

namespace vipnytt\RobotsTxtParser\Tests;

use PHPUnit\Framework\TestCase;
use vipnytt\RobotsTxtParser;

/**
 * Class ByteLimitTest
 *
 * @package vipnytt\RobotsTxtParser\Tests
 */
class ByteLimitTest extends TestCase
{
    /**
     * @dataProvider generateDataForTest
     * @param int|null $byteLimit
     * @param bool $warning
     */
    public function testByteLimitException($byteLimit, $warning)
    {
        if ($warning) {
            $this->expectException(\InvalidArgumentException::class);
        }
        new RobotsTxtParser\TxtClient('http://example.com', 200, '', 'UTF-8', 'http://example.com', $byteLimit);
    }

    /**
     * Generate test data
     *
     * @return array
     */
    public function generateDataForTest()
    {
        return [
            [
                null,
                false,
            ],
            [
                24000,
                true,
            ],
            [
                25000,
                false,
            ],
        ];
    }
}<commit_msg>Byte-limit test - no longer risky<commit_after><?php
/**
 * vipnytt/RobotsTxtParser
 *
 * @link https://github.com/VIPnytt/RobotsTxtParser
 * @license https://github.com/VIPnytt/RobotsTxtParser/blob/master/LICENSE The MIT License (MIT)
 */

namespace vipnytt\RobotsTxtParser\Tests;

use PHPUnit\Framework\TestCase;
use vipnytt\RobotsTxtParser;

/**
 * Class ByteLimitTest
 *
 * @package vipnytt\RobotsTxtParser\Tests
 */
class ByteLimitTest extends TestCase
{
    /**
     * @dataProvider generateDataForTest
     * @param int|null $byteLimit
     */
    public function testByteLimitException($byteLimit)
    {
        if ($byteLimit !== null) {
            // PHPUnit 7: Switch to \PHPUnit\Framework\Constraint\IsType::TYPE_INT
            $this->assertInternalType('int', $byteLimit);
            if (24 * 1024 > $byteLimit) {
                // Less than 24 kilobytes
                $this->expectException(\InvalidArgumentException::class);
            }
        }
        new RobotsTxtParser\TxtClient('http://example.com', 200, '', 'UTF-8', 'http://example.com', $byteLimit);
    }

    /**
     * Generate test data
     *
     * @return array
     */
    public function generateDataForTest()
    {
        return [
            [
                null,
            ],
            [
                24000,
            ],
            [
                25000,
            ],
        ];
    }
}
{'fraction_non_alphanumeric': 0.12214611872146118, 'fraction_numerical': 0.014079147640791476, 'mean_word_length': 1.8299246501614639, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2230890', 'n_tokens_mistral': 815, 'n_tokens_neox': 777, 'n_words': 133}