diff --git a/.gitignore b/.gitignore index 3a9875b..1f2eb36 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /vendor/ composer.lock +/nbproject/private/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 9ef9ad3..b57618f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,18 @@ language: php -matrix: - fast_finish: true - include: - - php: 5.5 - - php: 5.6 - - php: 7 - - php: hhvm +php: + - 5.6 + - 7.0 + - 7.1 -install: - - travis_retry composer install --no-interaction --ignore-platform-reqs --prefer-source - - composer info -i +env: + - DEPS=lowest + - DEPS=latest + +before_script: + - phpenv config-rm xdebug.ini + - if [[ $DEPS == 'lowest' ]]; then composer update --prefer-stable --no-interaction --prefer-lowest ; fi + - if [[ $DEPS == 'latest' ]]; then composer update --prefer-stable --no-interaction ; fi script: - ./vendor/bin/phpunit diff --git a/Module.php b/Module.php deleted file mode 100644 index ebebdf3..0000000 --- a/Module.php +++ /dev/null @@ -1,3 +0,0 @@ -=5.6", + "psr/container": "^1.0" }, "require-dev": { "psr/http-message": "^1.0", - "phpunit/phpunit": "^4.8.21", + "phpunit/phpunit": "^5.6 || ^6.0", "zendframework/zend-http": "^2.4", "zendframework/zend-eventmanager": "^2.4", "zendframework/zend-mvc": "^2.4", diff --git a/src/HttpMethodOverrideListenerFactory.php b/src/HttpMethodOverrideListenerFactory.php index 714e26b..3a0df9d 100644 --- a/src/HttpMethodOverrideListenerFactory.php +++ b/src/HttpMethodOverrideListenerFactory.php @@ -2,12 +2,14 @@ namespace RstGroup\HttpMethodOverride; +use Psr\Container\ContainerInterface; + /** * @codeCoverageIgnore */ final class HttpMethodOverrideListenerFactory { - public function __invoke($services) + public function __invoke(ContainerInterface $services) { $service = $services->get(HttpMethodOverrideService::class); diff --git a/src/HttpMethodOverrideMiddlewareFactory.php b/src/HttpMethodOverrideMiddlewareFactory.php index 2a1a12a..8f03abb 100644 --- a/src/HttpMethodOverrideMiddlewareFactory.php +++ b/src/HttpMethodOverrideMiddlewareFactory.php @@ -2,12 +2,14 @@ namespace RstGroup\HttpMethodOverride; +use Psr\Container\ContainerInterface; + /** * @codeCoverageIgnore */ final class HttpMethodOverrideMiddlewareFactory { - public function __invoke($services) + public function __invoke(ContainerInterface $services) { $service = $services->get(HttpMethodOverrideService::class); diff --git a/src/HttpMethodOverrideServiceFactory.php b/src/HttpMethodOverrideServiceFactory.php index ce80226..bb39eaa 100644 --- a/src/HttpMethodOverrideServiceFactory.php +++ b/src/HttpMethodOverrideServiceFactory.php @@ -2,12 +2,14 @@ namespace RstGroup\HttpMethodOverride; +use Psr\Container\ContainerInterface; + /** * @codeCoverageIgnore */ final class HttpMethodOverrideServiceFactory { - public function __invoke($services) + public function __invoke(ContainerInterface $services) { $config = $services->get('config')['rst_group']['http_method_override']; diff --git a/test/HttpMethodOverrideListenerTest.php b/test/HttpMethodOverrideListenerTest.php index 2492b7a..a2ba235 100644 --- a/test/HttpMethodOverrideListenerTest.php +++ b/test/HttpMethodOverrideListenerTest.php @@ -2,7 +2,7 @@ namespace RstGroup\HttpMethodOverride\Test; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use RstGroup\HttpMethodOverride\HttpMethodOverrideListener; use RstGroup\HttpMethodOverride\HttpMethodOverrideService; use Zend\EventManager\EventManagerInterface; @@ -10,7 +10,7 @@ use Zend\Mvc\MvcEvent; use Zend\Stdlib\RequestInterface; -class HttpMethodOverrideListenerTest extends PHPUnit_Framework_TestCase +class HttpMethodOverrideListenerTest extends TestCase { protected $listener; @@ -53,7 +53,7 @@ public function testNotOverride() public function testNoneHtmlRequest() { - $request = $this->getMock(RequestInterface::class); + $request = $this->createMock(RequestInterface::class); $event = new MvcEvent(); $event->setRequest($request); @@ -67,7 +67,7 @@ public function testNoneHtmlRequest() public function testAttach() { - $eventManager = $this->getMock(EventManagerInterface::class); + $eventManager = $this->createMock(EventManagerInterface::class); $eventManager->expects($this->once())->method('attach')->willReturnCallback(function($name, $callback){ $this->assertTrue(is_callable($callback)); }); diff --git a/test/HttpMethodOverrideMiddlewareTest.php b/test/HttpMethodOverrideMiddlewareTest.php index 18dd7ba..5452f54 100644 --- a/test/HttpMethodOverrideMiddlewareTest.php +++ b/test/HttpMethodOverrideMiddlewareTest.php @@ -2,14 +2,14 @@ namespace RstGroup\HttpMethodOverride\Test; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use RstGroup\HttpMethodOverride\HttpMethodOverrideMiddleware; use RstGroup\HttpMethodOverride\HttpMethodOverrideService; use Zend\Diactoros\ServerRequest; -class HttpMethodOverrideMiddlewareTest extends PHPUnit_Framework_TestCase +class HttpMethodOverrideMiddlewareTest extends TestCase { protected $middleware; @@ -22,8 +22,8 @@ protected function setUp() public function testCallNext() { - $request = $this->getMock(ServerRequestInterface::class); - $response = $this->getMock(ResponseInterface::class); + $request = $this->createMock(ServerRequestInterface::class); + $response = $this->createMock(ResponseInterface::class); $next = function(ServerRequestInterface $request, ResponseInterface $response) { return $response; @@ -40,7 +40,7 @@ public function testOverride() $request = $request->withHeader(HttpMethodOverrideService::OVERRIDE_HEADER, 'PUT'); $request = $request->withMethod('POST'); - $response = $this->getMock(ResponseInterface::class); + $response = $this->createMock(ResponseInterface::class); $next = function(ServerRequestInterface $request) { $this->assertSame('PUT', $request->getMethod()); @@ -55,7 +55,7 @@ public function testNotOverride() $request = $request->withHeader(HttpMethodOverrideService::OVERRIDE_HEADER, 'GET'); $request = $request->withMethod('POST'); - $response = $this->getMock(ResponseInterface::class); + $response = $this->createMock(ResponseInterface::class); $next = function(ServerRequestInterface $request) { $this->assertSame('POST', $request->getMethod()); diff --git a/test/HttpMethodOverrideServiceTest.php b/test/HttpMethodOverrideServiceTest.php index 8521ba3..b0f0847 100644 --- a/test/HttpMethodOverrideServiceTest.php +++ b/test/HttpMethodOverrideServiceTest.php @@ -3,10 +3,10 @@ namespace RstGroup\HttpMethodOverride\Test; use InvalidArgumentException; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use RstGroup\HttpMethodOverride\HttpMethodOverrideService; -class HttpMethodOverrideServiceTest extends PHPUnit_Framework_TestCase +class HttpMethodOverrideServiceTest extends TestCase { /** * @dataProvider notmethodInMapProvider @@ -74,7 +74,7 @@ public function testMapIsNotAnArray() { $object = new HttpMethodOverrideService(['POST' => 'NONE']); - $this->setExpectedException(InvalidArgumentException::class); + $this->expectException(InvalidArgumentException::class); $object->getOverridedMethod('POST', [ HttpMethodOverrideService::OVERRIDE_HEADER_GOOGLE => 'NONE',