Skip to content

Commit

Permalink
Merge branch 'dopesong-abstract-handler-phpunit' into 3.x
Browse files Browse the repository at this point in the history
Closes #1877
  • Loading branch information
akrabat committed May 16, 2016
2 parents fd02286 + 89029ae commit 794073a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/Handlers/AbstractHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,23 @@ class AbstractHandlerTest extends \PHPUnit_Framework_TestCase
public function testHalfValidContentType()
{
$req = $this->getMockBuilder('Slim\Http\Request')->disableOriginalConstructor()->getMock();
$req->expects($this->any())->method('getHeaderLine')->will($this->returnValue('unknown/json'));

$req->expects($this->any())->method('getHeaderLine')->will($this->returnValue('unknown/+json'));

$abstractHandler = $this->getMockForAbstractClass(AbstractHandler::class);

$newTypes = [
'application/xml',
'text/xml',
'text/html',
];

$class = new \ReflectionClass(AbstractHandler::class);

$reflectionProperty = $class->getProperty('knownContentTypes');
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($abstractHandler, $newTypes);

$method = $class->getMethod('determineContentType');
$method->setAccessible(true);

Expand Down

0 comments on commit 794073a

Please sign in to comment.