Skip to content

Commit

Permalink
Include dev deps & fix Server::findroute countable warning (#39)
Browse files Browse the repository at this point in the history
* Add phpunit as dev dep

* update tests with PHPUnit\Framework\Testcase

* force params with ? in request URL

* return empty array instead of null to satisfy countable

* Include 5.3 precise test runner

* Use earlier version of phpunit
  • Loading branch information
superdave2u authored and marcj committed Mar 6, 2019
1 parent 3263cd2 commit 5fb617a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor/
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6

matrix:
include:
- php: 5.3
dist: precise

before_script:
# Composer
- wget http://getcomposer.org/composer.phar
Expand Down
4 changes: 2 additions & 2 deletions RestService/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -1181,9 +1181,9 @@ public function argumentName($pName)
public function findRoute($pUri, $pMethod = '_all_')
{
if (isset($this->routes[$pUri][$pMethod]) && $method = $this->routes[$pUri][$pMethod]) {
return array($method, null, $pMethod, $pUri);
return array($method, array(), $pMethod, $pUri);
} elseif ($pMethod != '_all_' && isset($this->routes[$pUri]['_all_']) && $method = $this->routes[$pUri]['_all_']) {
return array($method, null, $pMethod, $pUri);
return array($method, array(), $pMethod, $pUri);
} else {
//maybe we have a regex uri
foreach ($this->routes as $routeUri => $routeMethods) {
Expand Down
4 changes: 2 additions & 2 deletions Test/Basic/BasicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use RestService\Server;
use Test\Controller\MyRoutes;

class BasicTest extends \PHPUnit_Framework_TestCase
class BasicTest extends \PHPUnit\Framework\TestCase
{
public function testCustomUrl()
{
Expand All @@ -20,4 +20,4 @@ public function testCustomUrl()
}', $response);

}
}
}
2 changes: 1 addition & 1 deletion Test/Synthetic/CollectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use RestService\Server;
use Test\Controller\MyRoutes;

class CollectTest extends \PHPUnit_Framework_TestCase
class CollectTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Server
Expand Down
4 changes: 2 additions & 2 deletions Test/Synthetic/CustomRoutesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use RestService\Server;
use Test\Controller\MyRoutes;

class CustomRoutesTest extends \PHPUnit_Framework_TestCase
class CustomRoutesTest extends \PHPUnit\Framework\TestCase
{

public function testOwnController()
Expand All @@ -14,7 +14,7 @@ public function testOwnController()
->setClient('RestService\\InternalClient')
->addPostRoute('login', 'postLogin');

$response = $restService->simulateCall('/login', 'post');
$response = $restService->simulateCall('/login?', 'post');

$this->assertEquals('{
"status": 400,
Expand Down
2 changes: 1 addition & 1 deletion Test/Synthetic/RouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use RestService\Server;

class RouteTest extends \PHPUnit_Framework_TestCase
class RouteTest extends \PHPUnit\Framework\TestCase
{

public function testAllRoutesClosures()
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
"psr-0": {
"RestService": ""
}
},
"require-dev": {
"phpunit/phpunit": "^4"
}
}
}

0 comments on commit 5fb617a

Please sign in to comment.