Skip to content

Commit

Permalink
Merge pull request #13 from anthonykusuma/master
Browse files Browse the repository at this point in the history
Update Removed getContentType with getContentTypeFormat
  • Loading branch information
mtownsend5512 authored Apr 3, 2024
2 parents 46f63f2 + f6179a5 commit 1387d35
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
39 changes: 19 additions & 20 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="MyPackage Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
backupGlobals="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="MyPackage Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
6 changes: 5 additions & 1 deletion src/Providers/RequestXmlServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ protected function registerWantsXml()
protected function registerIsXml()
{
Request::macro('isXml', function () {
return Str::contains(strtolower($this->getContentType() ?? ''), 'xml');
if (method_exists($this, 'getContentType')) {
return Str::contains(strtolower($this->getContentType() ?? ''), 'xml');
}

return Str::contains(strtolower($this->getContentTypeFormat() ?? ''), 'xml');
});
}

Expand Down
2 changes: 1 addition & 1 deletion tests/RequestXmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use PHPUnit\Framework\TestCase;
use ReflectionClass as Reflect;

class RequestXml extends TestCase
class RequestXmlTest extends TestCase
{

/** @test array */
Expand Down

0 comments on commit 1387d35

Please sign in to comment.