Skip to content

Commit 9e29eec

Browse files
committed
First commit.
0 parents  commit 9e29eec

14 files changed

+2495
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
composer.phar
2+
/vendor/
3+
4+
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
5+
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
6+
# composer.lock

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Using PHP Built-in Server to run automated testing
2+
3+
## Description
4+
5+
`phpunit` is widely used to unit-test `PHP` code, but using the `PHP` built-in
6+
server, it can be used to run *functional* tests
7+
(see [#20 here](https://www.softwaretestinghelp.com/types-of-software-testing/))
8+
to verify that your application is behaving as expected and that the rendered
9+
output is correct.
10+
11+
### Included tests
12+
13+
* [`test/StaticPagesTest.php`](test/StaticPagesTest.php)
14+
Test for static `HTML` pages
15+
* [`test/DynamicPagesTest.php`](test/DynamicPagesTest.php)
16+
Test for dynamic `PHP` pages
17+
* [`test/RoutesTest.php`](test/RoutesTest.php)
18+
Test for dynamically routed pages
19+
20+
## Requirements
21+
22+
* [`PHP 7.x`](http://php.net)
23+
* [`Composer`](https://getcomposer.org)
24+
25+
## Installation
26+
27+
Clone the repository, then run:
28+
29+
```
30+
$ composer install
31+
```
32+
33+
## Usage
34+
35+
### Simulate *passing* tests
36+
37+
Run:
38+
39+
```
40+
$ ./vendor/bin/phpunit
41+
```
42+
43+
### Simulate *errors*
44+
45+
Remove the `.skip_this` extension from:
46+
47+
* [`www/not_valid.html.skip_this`](www/not_valid.html.skip_this)
48+
* [`www/code_error.php.skip_this`](www/code_error.php.skip_this)
49+
50+
then run:
51+
52+
```
53+
$ ./vendor/bin/phpunit
54+
```

composer.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"require-dev": {
3+
"ezyang/htmlpurifier": "^4.10",
4+
"phpunit/phpunit": "^7.5",
5+
"symfony/process": "^4.2",
6+
"guzzlehttp/guzzle": "^6.3",
7+
"masterminds/html5": "^2.5"
8+
},
9+
"require": {
10+
"slim/slim": "^3.0"
11+
}
12+
}

0 commit comments

Comments
 (0)