Skip to content

Commit 23c70db

Browse files
committed
also phpunit
1 parent 5be3cc9 commit 23c70db

File tree

5 files changed

+59
-2
lines changed

5 files changed

+59
-2
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ Blanket is a Simple REST microframework similar to Rack or Silex.
55
To run tests:
66

77
$ composer install
8-
$ ./vendor/phpspec/phpspec/bin/phpspec run
8+
$ ./vendor/phpspec/phpspec/bin/phpspec run
9+
$ ./vendor/bin/phpunit --configuration=./phpunit.xml

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
}
99
},
1010
"require-dev": {
11-
"phpspec/phpspec": "^3.2"
11+
"phpspec/phpspec": "^3.2",
12+
"phpunit/phpunit": "^5.7"
1213
}
1314
}

phpunit.php

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
require __DIR__ . '/vendor/autoload.php';

phpunit.xml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="phpunit.php"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="false"
12+
>
13+
<testsuites>
14+
<testsuite name="Blanket Test Suite">
15+
<directory>./test/</directory>
16+
</testsuite>
17+
</testsuites>
18+
19+
<filter>
20+
<whitelist addUncoveredFilesFromWhitelist="false">
21+
<directory suffix=".php">src</directory>
22+
<exclude>
23+
<directory suffix=".php">vendor</directory>
24+
</exclude>
25+
</whitelist>
26+
</filter>
27+
</phpunit>

test/AppGetTest.php

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
use Blanket\App;
4+
use Blanket\Request;
5+
6+
class AppGetTest extends PHPUnit_Framework_TestCase {
7+
8+
function testGetRequest() {
9+
/** @var Request $request */
10+
$request = $this->getMockBuilder(Request::class)->getMock();
11+
12+
$data = ['hi' => 'there'];
13+
14+
$app = new App();
15+
$app->get('funky', function() use ($data) {
16+
return $data;
17+
});
18+
19+
$request->method = 'get';
20+
$request->path = 'funky';
21+
22+
$this->assertEquals($data, $app->getResponse($request));
23+
}
24+
25+
}

0 commit comments

Comments
 (0)