-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kazushige Tominaga
committed
Dec 19, 2015
1 parent
e35f75e
commit 2a49a96
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Test library | ||
|
||
This is a library for testing PHP legacy product. | ||
If you have difficulty with testing such products, this library can help you. | ||
|
||
## Usage | ||
|
||
First, create a new "FunctionalTester" instance. | ||
|
||
You can set session or include paths used in your target product. | ||
|
||
If you call `request` method like http request, you can get a parsed response instance of `Guzzle\Http\Message\Response` | ||
|
||
```php | ||
use Test/FunctionalTester; | ||
|
||
$tester = new FunctionalTester(); | ||
|
||
//set session used in your target product. | ||
$tester->setSession(['id' => 'hogehoge']); | ||
|
||
//add includePath used in your target product. | ||
$tester->addIncludePath(':/path/to/src'); | ||
|
||
//if you can get response like http request if you call get or post method | ||
$response = $tester->get('index.php', ['username' => 'hogehoge']); | ||
|
||
//you can assert request results like this | ||
$this->assertEquals(200, $response->getStatusCode()); | ||
$this->assertEquals('OK', $response->getBody()); | ||
|
||
``` | ||
|
||
|
||
## Tests | ||
|
||
To execute the test suite, you'll need phpunit. | ||
|
||
```bash | ||
$ phpunit | ||
``` | ||
|
||
## License | ||
|
||
The Slim Framework is licensed under the MIT license. See [License File](LICENSE.md) for more information. |