7
7
8
8
class XmlRequestMacrosTest extends TestCase
9
9
{
10
- public function setup ()
10
+ public function setUp (): void
11
11
{
12
12
if (!Request::hasMacro ('xml ' ) || !Request::hasMacro ('isXml ' )) {
13
13
(new XmlRequestServiceProvider (null ))->register ();
14
14
}
15
15
}
16
16
17
- protected function createRequest ($ headers = [], $ content = null )
17
+ protected function createRequest ($ headers = [], $ content = null ): Request
18
18
{
19
19
return new Request ([], [], [], [], [], $ headers , $ content );
20
20
}
21
21
22
- public function contentTypeDataProvider ()
22
+ public function contentTypeDataProvider (): array
23
23
{
24
24
return [
25
25
['application/xml ' , true , '<xml><person>human</person></xml> ' , ['person ' => 'human ' ]],
@@ -35,20 +35,20 @@ public function contentTypeDataProvider()
35
35
* @param string $contentType
36
36
* @param bool $assertion
37
37
*/
38
- public function testIsXmlMethod ($ contentType , $ assertion )
38
+ public function testIsXmlMethod (string $ contentType , bool $ assertion ): void
39
39
{
40
40
$ this ->assertEquals ($ assertion , $ this ->createRequest (['CONTENT_TYPE ' => $ contentType ])->isXml ());
41
41
}
42
42
43
43
/**
44
44
* @dataProvider contentTypeDataProvider
45
45
*
46
- * @param $contentType
47
- * @param $typeAssertion
48
- * @param $content
49
- * @param string $expectedContent
46
+ * @param string $contentType
47
+ * @param bool $typeAssertion
48
+ * @param string $content
49
+ * @param array $expectedContent
50
50
*/
51
- public function testXmlMethod ($ contentType , $ typeAssertion , $ content , $ expectedContent = '' )
51
+ public function testXmlMethod (string $ contentType , bool $ typeAssertion , string $ content , array $ expectedContent = []): void
52
52
{
53
53
$ request = $ this ->createRequest (['CONTENT_TYPE ' => $ contentType ], $ content );
54
54
if ($ typeAssertion ) {
@@ -63,12 +63,12 @@ public function testXmlMethod($contentType, $typeAssertion, $content, $expectedC
63
63
/**
64
64
* @dataProvider contentTypeDataProvider
65
65
*
66
- * @param $contentType
67
- * @param $isXml
68
- * @param $content
69
- * @param string $expectedContent
66
+ * @param string $contentType
67
+ * @param bool $isXml
68
+ * @param string $content
69
+ * @param array $expectedContent
70
70
*/
71
- public function testXmlMiddleware ($ contentType , $ isXml , $ content , $ expectedContent = '' )
71
+ public function testXmlMiddleware (string $ contentType , bool $ isXml , string $ content , array $ expectedContent = []): void
72
72
{
73
73
$ request = $ this ->createRequest (['CONTENT_TYPE ' => $ contentType ], $ content );
74
74
// Make sure we have an empty array before middleware
0 commit comments