Skip to content

Commit 74fb53c

Browse files
committed
Added tests
1 parent 671f0bf commit 74fb53c

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

phpunit.xml.dist

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" syntaxCheck="false" bootstrap="tests/bootstrap.php">
4+
<testsuites>
5+
<testsuite name="Router Tests">
6+
<directory>tests/</directory>
7+
</testsuite>
8+
</testsuites>
9+
<filter>
10+
<whitelist>
11+
<directory suffix=".php">src/</directory>
12+
</whitelist>
13+
</filter>
14+
</phpunit>

tests/RouterTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
class RouterTest extends PHPUnit_Framework_TestCase
4+
{
5+
protected function setUp()
6+
{
7+
// Clear SCRIPT_NAME because bramus/router tries to guess the subfolder the script is run in
8+
$_SERVER['SCRIPT_NAME'] = '/index.php';
9+
10+
// Default request method to GET
11+
$_SERVER['REQUEST_METHOD'] = 'GET';
12+
13+
// Default SERVER_PROTOCOL method to HTTP/1.1
14+
$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
15+
}
16+
17+
protected function tearDown()
18+
{
19+
// nothing
20+
}
21+
22+
public function testInit()
23+
{
24+
$this->assertInstanceOf('\Buki\Router', new \Buki\Router());
25+
}
26+
}

tests/bootstrap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
require 'vendor/autoload.php';

0 commit comments

Comments
 (0)