Skip to content

Commit 9bfd088

Browse files
committed
Add tests to test case sensitivity
1 parent aaca3fb commit 9bfd088

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/ChunkedDecoderTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,4 +447,36 @@ public function testEmptyHeaderAndFilledBodyLeadsToError()
447447

448448
$this->input->emit('data', array("\r\nhello\r\n"));
449449
}
450+
451+
public function testUpperCaseHexWillBeHandled()
452+
{
453+
$this->parser->on('data', $this->expectCallableOnceWith('0123456790'));
454+
$this->parser->on('error', $this->expectCallableNever());
455+
$this->parser->on('end', $this->expectCallableNever());
456+
$this->parser->on('close', $this->expectCallableNever());
457+
458+
$this->input->emit('data', array("A\r\n0123456790\r\n"));
459+
}
460+
461+
public function testLowerCaseHexWillBeHandled()
462+
{
463+
$this->parser->on('data', $this->expectCallableOnceWith('0123456790'));
464+
$this->parser->on('error', $this->expectCallableNever());
465+
$this->parser->on('end', $this->expectCallableNever());
466+
$this->parser->on('close', $this->expectCallableNever());
467+
468+
$this->input->emit('data', array("a\r\n0123456790\r\n"));
469+
}
470+
471+
public function testMixedUpperAndLowerCaseHexValuesInHeaderWillBeHandled()
472+
{
473+
$data = str_repeat('1', (int)hexdec('AA'));
474+
475+
$this->parser->on('data', $this->expectCallableOnceWith($data));
476+
$this->parser->on('error', $this->expectCallableNever());
477+
$this->parser->on('end', $this->expectCallableNever());
478+
$this->parser->on('close', $this->expectCallableNever());
479+
480+
$this->input->emit('data', array("aA\r\n" . $data . "\r\n"));
481+
}
450482
}

0 commit comments

Comments
 (0)