File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 1414use Hyperf \HttpMessage \Exception \BadRequestHttpException ;
1515use Hyperf \HttpMessage \Server \RequestParserInterface ;
1616use Hyperf \Utils \Codec \Xml ;
17- use Hyperf \ Utils \ Exception \ InvalidArgumentException ;
17+ use InvalidArgumentException ;
1818
1919class XmlParser implements RequestParserInterface
2020{
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+ /**
5+ * This file is part of Hyperf.
6+ *
7+ * @link https://www.hyperf.io
8+ * @document https://hyperf.wiki
9+ 10+ * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
11+ */
12+ namespace HyperfTest \HttpMessage ;
13+
14+ use Hyperf \HttpMessage \Exception \BadRequestHttpException ;
15+ use Hyperf \HttpMessage \Server \Request \JsonParser ;
16+ use Hyperf \HttpMessage \Server \Request \XmlParser ;
17+ use PHPUnit \Framework \TestCase ;
18+
19+ /**
20+ * @internal
21+ * @coversNothing
22+ */
23+ class RequestParserTest extends TestCase
24+ {
25+ public function testJsonParserFailed ()
26+ {
27+ $ this ->expectException (BadRequestHttpException::class);
28+ $ parser = new JsonParser ();
29+ $ parser ->parse ('{"hy" ' , '' );
30+ }
31+
32+ public function testXmlParserFailed ()
33+ {
34+ $ this ->expectException (BadRequestHttpException::class);
35+ $ parser = new XmlParser ();
36+ $ parser ->parse ('{"hy" ' , '' );
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments