Skip to content

Commit

Permalink
Bump PHPUnit 9.5 and update test (#14)
Browse files Browse the repository at this point in the history
* bump version

* update test for phpunit 9
  • Loading branch information
samuelhowell authored Feb 26, 2022
1 parent 1ee41c4 commit 3579805
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"illuminate/http": "^5.0|^6.0|^7.0|^8.0|^v9.0"
},
"require-dev": {
"phpunit/phpunit": "~5.4.0"
"phpunit/phpunit": "^9.5"
},
"license": "MIT",
"authors": [
Expand Down
28 changes: 14 additions & 14 deletions tests/XmlRequestMacrosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@

class XmlRequestMacrosTest extends TestCase
{
public function setup()
public function setUp():void
{
if (!Request::hasMacro('xml') || !Request::hasMacro('isXml')) {
(new XmlRequestServiceProvider(null))->register();
}
}

protected function createRequest($headers = [], $content = null)
protected function createRequest($headers = [], $content = null): Request
{
return new Request([], [], [], [], [], $headers, $content);
}

public function contentTypeDataProvider()
public function contentTypeDataProvider(): array
{
return [
['application/xml', true, '<xml><person>human</person></xml>', ['person' => 'human']],
Expand All @@ -35,20 +35,20 @@ public function contentTypeDataProvider()
* @param string $contentType
* @param bool $assertion
*/
public function testIsXmlMethod($contentType, $assertion)
public function testIsXmlMethod(string $contentType, bool$assertion):void
{
$this->assertEquals($assertion, $this->createRequest(['CONTENT_TYPE' => $contentType])->isXml());
}

/**
* @dataProvider contentTypeDataProvider
*
* @param $contentType
* @param $typeAssertion
* @param $content
* @param string $expectedContent
* @param string $contentType
* @param bool $typeAssertion
* @param string $content
* @param array $expectedContent
*/
public function testXmlMethod($contentType, $typeAssertion, $content, $expectedContent = '')
public function testXmlMethod(string $contentType, bool $typeAssertion, string $content, array $expectedContent = []):void
{
$request = $this->createRequest(['CONTENT_TYPE' => $contentType], $content);
if ($typeAssertion) {
Expand All @@ -63,12 +63,12 @@ public function testXmlMethod($contentType, $typeAssertion, $content, $expectedC
/**
* @dataProvider contentTypeDataProvider
*
* @param $contentType
* @param $isXml
* @param $content
* @param string $expectedContent
* @param string $contentType
* @param bool $isXml
* @param string $content
* @param array $expectedContent
*/
public function testXmlMiddleware($contentType, $isXml, $content, $expectedContent = '')
public function testXmlMiddleware(string $contentType, bool $isXml, string $content, array $expectedContent = []):void
{
$request = $this->createRequest(['CONTENT_TYPE' => $contentType], $content);
// Make sure we have an empty array before middleware
Expand Down

0 comments on commit 3579805

Please sign in to comment.