A test suite to validate PSR-7 UriInterface implementation
Out of the box this package can run the tests against the following implementations (order alphabetically):
You need:
mbstring
extensionintl
extensionClone this repo on a composer installed box and run the following command from the project folder.
$ composer install
To run the tests, run the following command from the project folder.
$ composer test
You 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
UriInterface
interface implementation is available on packagist firstcomposer.json
file with your packagetests
directory for your implementation that extends Bakame\Psr7\UriTest\AbstractUriTestCase
by 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);
}
}
README.md
file 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.