Out of the box this package can run the tests against the following implementations (order alphabetically):
- Guzzle PSR-7
- Jasny HTTP Message
- League URI schemes
- PHPixie
- Riimu KIT UrlParser
- Slim
- Spatie URL
- Windwalker URI
- Zend Diactoros
You need:
- The latest stable version of PHP is recommended
- the
mbstringextension - the
intlextension
Clone this repo on a composer installed box and run the following command from the project folder.
$ composer installTo run the tests, run the following command from the project folder.
$ composer testYou can also run different tests according to the following groups:
| Group | Run tests for the |
|---|---|
uri |
complete URI |
scheme |
scheme component |
userinfo |
userinfo component |
host |
host component |
port |
port component |
authority |
authority part |
path |
path component |
query |
query component |
fragment |
fragment component |
Or run all the test against a specific implementation
| Group | Run tests against |
|---|---|
diactoros |
Zend\Diactoros\Uri |
guzzle |
Guzzle\Psr7\Uri |
jasny |
Jasny\HttpMessage\Uri |
league |
League\Uri\Schemes\Http |
phpixie |
PHPixie\HTTP\Messages\URI\Implementation |
riimu |
Riimu\Kit\UrlParser\Uri |
slim |
Slim\HTTP\Uri |
spatie |
Spatie\Url\Url |
windwalker |
Windwalker\Uri\PsrUri |
example
$ composer test -- --group port
$ composer test -- --group spatie- Make sure your PSR-7
UriInterfaceinterface implementation is available on packagist first - Clone this repo
- Update the
composer.jsonfile with your package - Add a new class in the
testsdirectory for your implementation that extendsBakame\Psr7\UriTest\AbstractUriTestCaseby providing a URI factory to bootstrap URI object creation from your library.
Here's a example to copy/paste and edit
<?php
namespace Bakame\Psr7\UriTest;
use My\Library\Uri;
/**
* @group my-library
*/
final class MyLibraryTest extends AbstractUriTestCase
{
protected function createUri($uri = '')
{
return new Uri($uri);
}
}- run the test suite.
- you can submit your implementation via Pull Request (don't forget to update the
README.mdfile with a link to your repo in the Tested implementation section).
Contributions are welcome and will be fully credited. Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.