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 #1876
  • Loading branch information
akrabat committed May 16, 2016
2 parents 448d9a6 + 6330ae9 commit fd02286
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/Handlers/AbstractHandlerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* Slim Framework (http://slimframework.com)
*
* @link https://github.com/slimphp/Slim
* @copyright Copyright (c) 2011-2016 Josh Lockhart
* @license https://github.com/slimphp/Slim/blob/master/LICENSE.md (MIT License)
*/
namespace Slim\Tests\Handlers;

use Slim\Handlers\AbstractHandler;

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'));

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

$class = new \ReflectionClass(AbstractHandler::class);
$method = $class->getMethod('determineContentType');
$method->setAccessible(true);

$return = $method->invoke($abstractHandler, $req);

$this->assertEquals('text/html', $return);
}
}

0 comments on commit fd02286

Please sign in to comment.