Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Kazushige Tominaga committed Dec 19, 2015
1 parent e35f75e commit 2a49a96
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions README.md
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.

0 comments on commit 2a49a96

Please sign in to comment.