Skip to content

Commit efa843a

Browse files
committed
Adding basic PHPUnit testing capabilities
1 parent 98bb980 commit efa843a

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
"require": {
1616
"php": ">=5.2.7"
1717
},
18+
"require-dev": {
19+
"phpunit/phpunit": "5.5.x"
20+
},
1821
"autoload": {
1922
"psr-0": {
2023
"GuahanWeb\\Http": "src/"

phpunit.xml.dist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<phpunit bootstrap="./vendor/autoload.php">
3+
<testsuites>
4+
<testsuite name="PHP Router Test Suite">
5+
<directory>./tests</directory>
6+
</testsuite>
7+
</testsuites>
8+
</phpunit>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
use PHPUnit\Framework\TestCase;
3+
use GuahanWeb\Http;
4+
5+
class RequestTest extends TestCase {
6+
protected function tearDown() {
7+
$_SERVER = null;
8+
}
9+
10+
public function testBasicAttributes() {
11+
// Mock request
12+
$_SERVER = array(
13+
'REQUEST_METHOD' => 'GET',
14+
'REQUEST_URI' => '/'
15+
);
16+
17+
$request = new Http\Request();
18+
$this->assertEquals($request->method, 'GET');
19+
$this->assertEquals($request->uri, '/');
20+
}
21+
}

0 commit comments

Comments
 (0)