Skip to content

Commit 96b5cac

Browse files
committed
Byte-limit test - no longer risky
1 parent 0e6c48c commit 96b5cac

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

tests/ByteLimitTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@ class ByteLimitTest extends TestCase
2121
/**
2222
* @dataProvider generateDataForTest
2323
* @param int|null $byteLimit
24-
* @param bool $warning
2524
*/
26-
public function testByteLimitException($byteLimit, $warning)
25+
public function testByteLimitException($byteLimit)
2726
{
28-
if ($warning) {
29-
$this->expectException(\InvalidArgumentException::class);
27+
if ($byteLimit !== null) {
28+
// PHPUnit 7: Switch to \PHPUnit\Framework\Constraint\IsType::TYPE_INT
29+
$this->assertInternalType('int', $byteLimit);
30+
if (24 * 1024 > $byteLimit) {
31+
// Less than 24 kilobytes
32+
$this->expectException(\InvalidArgumentException::class);
33+
}
3034
}
3135
new RobotsTxtParser\TxtClient('http://example.com', 200, '', 'UTF-8', 'http://example.com', $byteLimit);
3236
}
@@ -41,15 +45,12 @@ public function generateDataForTest()
4145
return [
4246
[
4347
null,
44-
false,
4548
],
4649
[
4750
24000,
48-
true,
4951
],
5052
[
5153
25000,
52-
false,
5354
],
5455
];
5556
}

0 commit comments

Comments
 (0)