Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test enhancement #387

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@ sudo: false

language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- nightly
- hhvm

matrix:
include:
- php: 5.3
dist: precise
allow_failures:
- php: nightly
- php: hhvm
fast_finish: true

before_script:
- composer install --prefer-dist
- composer install --prefer-dist -n

script:
- composer validate
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"phpunit/php-code-coverage": "^2.2",
"phpunit/phpunit": "^4.8|^6.5",
"squizlabs/php_codesniffer": "1.4.8"
},
"autoload": {
Expand Down
4 changes: 2 additions & 2 deletions tests/Klein/Tests/AbstractKleinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
use Klein\Request;
use Klein\Response;
use Klein\Tests\Mocks\HeadersNoOp;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

/**
* AbstractKleinTest
*
* Base test class for PHP Unit testing
*/
abstract class AbstractKleinTest extends PHPUnit_Framework_TestCase
abstract class AbstractKleinTest extends TestCase
{

/**
Expand Down
10 changes: 9 additions & 1 deletion tests/Klein/Tests/AppTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,18 @@ public function testRegisterFiller()

$app->register($func_name, $this->getTestCallable());

return array(
$result = array(
'app' => $app,
'func_name' => $func_name,
);

$this->assertInstanceOf('Klein\App', $app);
$this->assertSame(array(
'app' => $app,
'func_name' => $func_name,
), $result);

return $result;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Klein/Tests/KleinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public function testAfterDispatchWithStringCallables()
);
}

public function testAfterDispatchWithBadCallables()
public function afterDispatchWithBadCallablesTest()
{
$this->klein_app->afterDispatch('this_function_doesnt_exist');

Expand Down
8 changes: 4 additions & 4 deletions tests/Klein/Tests/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function testLockedNotModifiable()
* Attempt to run in a separate process so we can
* at least call our internal methods
*/
public function testSendHeaders()
public function sendHeaders()
{
$response = new Response('woot!');
$response->headers()->set('test', 'sure');
Expand All @@ -203,7 +203,7 @@ public function testSendHeaders()
/**
* @runInSeparateProcess
*/
public function testSendHeadersInIsolateProcess()
public function sendHeadersInIsolateProcessTest()
{
$this->testSendHeaders();
}
Expand All @@ -212,7 +212,7 @@ public function testSendHeadersInIsolateProcess()
* Testing cookies is exactly like testing headers
* ... So, yea.
*/
public function testSendCookies()
public function sendCookiesTest()
{
$response = new Response();
$response->cookies()->set('test', 'woot!');
Expand All @@ -226,7 +226,7 @@ public function testSendCookies()
/**
* @runInSeparateProcess
*/
public function testSendCookiesInIsolateProcess()
public function sendCookiesInIsolateProcessTest()
{
$this->testSendCookies();
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Klein/Tests/ValidationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ function ($request, $response, $service) {
);
}

public function testUrl()
public function urlTest()
{
// Is
$this->validator('http://www.test.com/path/file.ext?query=param#anchor')->isUrl();
Expand All @@ -346,7 +346,7 @@ public function testUrl()
$this->validator('www.com')->notUrl();
}

public function testIp()
public function ipTest()
{
// Is
$this->validator('0000:0000:0000:0000:0000:0000:0000:0001')->isIp();
Expand All @@ -368,7 +368,7 @@ public function testIp()
$this->validator('string')->notIp();
}

public function testRemoteIp()
public function remoteIpTest()
{
// Is
$this->validator('2001:0db5:86a3:0000:0000:8a2e:0370:7335')->isRemoteIp();
Expand Down Expand Up @@ -791,7 +791,7 @@ function ($request, $response, $service) {
);
}

public function testCustomValidatorWithManyArgs()
public function customValidatorWithManyArgsTest()
{
// Add our custom validator
$this->klein_app->service()->addValidator(
Expand Down
3 changes: 1 addition & 2 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
ini_set('session.cache_limiter', ''); // Don't send cache headers when testing sessions

// Load our autoloader, and add our Test class namespace
$autoloader = require(__DIR__ . '/../vendor/autoload.php');
$autoloader->add('Klein\Tests', __DIR__);
require(__DIR__ . '/../vendor/autoload.php');

// Load our functions bootstrap
require(__DIR__ . '/functions-bootstrap.php');