PHP Classes
elePHPant
Icontem

PHP REST Client Framework Control: Testing and validating REST services

Recommend this page to a friend!
  Info   View files View files (234)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2018-03-17 (5 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 131 All time: 8,762 This week: 503Up
Version License PHP version Categories
rest-control 1.0.0MIT/X Consortium ...5HTTP, PHP 5, Web services, Testing
Description Author

This package can be used for testing and validating REST services.

It can configure and send HTTP requests using different methods like POST, GET, PUT, DELETE, HEAD, PATCH, PURGE, OPTIONS, TRACE and CONNECT. It supports:

- Emulate form submission
- Configure request headers
- Perform basic HTTP authentication
- oAuth protocol
- JSON response status and body validation
- Describe test details using annotations
- Measure the response time and retrieve test statistics
- Etc.

  Performance   Level  
Name: Kamil <contact>
Classes: 1 package by
Country: Poland Poland

Details

RestControl

About RestControl(Twitter)

RestControl is modern and powerful framework for testing REST services. RestControl provides set of tools for describing HTTP requests and responses in expressive and elegant way.

Latest Stable Version Latest Unstable Version License Build status Build Status

Examples

Here is a simple example of how to send a GET request and validate json response:

 /
  * @test(
  *     title="Example test",
  *     description="Example test description",
  *     tags="find user"
  * )
  */
 public function exampleFindUser()
 {
    return send()->get('https://jsonplaceholder.typicode.com/users/1')
                 ->expectedResponse()
                 ->httpStatusOk()
                 ->json()
                 ->jsonPath('$.address.street', endsWith('Light'));
 }

Features/Helpers

  • Easily sending HTTP Requests, variety of http methods like post, get, put, delete, head, patch, purge, options, trace, connect
  • forms
  • request headers
  • basic HTTP authentication
  • oAuth && oAuth2 authentication(in progress)
  • JSON response validation
  • JSON Path body validation
  • easily JSON body items and collection of items validation
  • sets of http response code helpers like httpStatusOk, httpBadGateway etc.
  • easily to use expression language - iteration over body items - values comparing (e.g. equalsTo, lessThan) - string validation (e.g. startsWith, endsWith) - custom validation via closure
  • annotations describing tests
  • measuring response time and tests statistics
  • XML validation(in progress)
  • easily system of tests environments
  • json, html reporting system(in progress)
  • cookies(in progress)
  • proxy, ssl support(in progress)
  • command for automatic generation of tests

Quick Start

The best way for quick start is to use RestControl standalone application. You can find it here https://github.com/rest-control/standalone-testing-application. If you want to save yourself the hassle of installing dependencies required for this project on your local machine, you can use Docker containers as an alternative. Note that you will need Docker and Docker Compose in version >= 2.1.

To build and start RestControl standalone application, run following commands:

user@user:~/projects/standalone-testing-application$ make build
user@user:~/projects/standalone-testing-application$ make start

Now, you can use Docker machine and run example tests.

user@user:~/projects/standalone-testing-application$ docker exec -it restcontrol_cli_1 bash
user@machineid:/app# php vendor/bin/rest-control run

Contributing

Thank you if you considering contributing to RestControl! The contribution guide will be available soon. Start watching this project to get regular updates.

Project roadmap

All planned releases you can find here: https://github.com/rest-control/rest-control/milestones.

Learning RestControl

RestControl documentation is under construction, please be patient. Current documentation files are available on https://rest-control.github.io/

  Files folder image Files  
File Role Description
Files folder image.github (3 files)
Files folder imagebin (1 file)
Files folder imagesrc (1 file, 8 directories)
Files folder imagetests (2 files, 7 directories)
Accessible without login Plain text file .coveralls.yml Data Auxiliary data
Accessible without login Plain text file .php_cs.dist Example Example script
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file appveyor.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file rest-control.yml-sample Data Auxiliary data

  Files folder image Files  /  .github  
File Role Description
  Accessible without login Plain text file ISSUE_TEMPLATE.md Data Auxiliary data
  Accessible without login Plain text file PULL_REQUEST_TEMPLATE.md Data Auxiliary data
  Accessible without login Image file rest-control.jpg Icon Icon image

  Files folder image Files  /  bin  
File Role Description
  Accessible without login Plain text file rest-control Example Example script

  Files folder image Files  /  src  
File Role Description
Files folder imageApiClient (5 files)
Files folder imageConsole (1 file, 2 directories)
Files folder imageLoader (4 files, 1 directory)
Files folder imageTestCase (9 files, 5 directories)
Files folder imageTestCasePipeline (5 files, 3 directories)
Files folder imageTraits (1 file)
Files folder imageUtils (4 files)
Files folder imageValidators (18 files)
  Accessible without login Plain text file helpers.php Example Example script

  Files folder image Files  /  src  /  ApiClient  
File Role Description
  Plain text file ApiClientInterface.php Class Class source
  Plain text file ApiClientRequest.php Class Class source
  Plain text file ApiClientResponse.php Class Class source
  Plain text file HttpGuzzleClient.php Class Class source
  Plain text file MockApiClient.php Class Class source

  Files folder image Files  /  src  /  Console  
File Role Description
Files folder imageCommands (3 files)
Files folder imageUtils (1 file)
  Plain text file Console.php Class Class source

  Files folder image Files  /  src  /  Console  /  Commands  
File Role Description
  Plain text file CreateTestCaseCommand.php Class Class source
  Plain text file HelpersTrait.php Class Class source
  Plain text file RunTestsCommand.php Class Class source

  Files folder image Files  /  src  /  Console  /  Utils  
File Role Description
  Plain text file ConsoleTestCasePipelineListener.php Class Class source

  Files folder image Files  /  src  /  Loader  
File Role Description
Files folder imageAnnotations (2 files)
  Plain text file LoaderInterface.php Class Class source
  Plain text file PsrClassLoader.php Class Class source
  Plain text file TestCaseDelegate.php Class Class source
  Plain text file TestsBag.php Class Class source

  Files folder image Files  /  src  /  Loader  /  Annotations  
File Role Description
  Plain text file AnnotationInterface.php Class Class source
  Plain text file TestAnnotation.php Class Class source

  Files folder image Files  /  src  /  TestCase  
File Role Description
Files folder imageExpressionLanguage (10 files)
Files folder imageResponseFilters (9 files, 1 directory)
Files folder imageStatsCollector (3 files)
Files folder imageStubs (2 files)
Files folder imageTraits (4 files)
  Plain text file AbstractChain.php Class Class source
  Plain text file AbstractTestCase.php Class Class source
  Plain text file ChainObject.php Class Class source
  Plain text file ChainTrait.php Class Class source
  Plain text file Request.php Class Class source
  Plain text file Response.php Class Class source
  Plain text file ResponseFiltersBag.php Class Class source
  Plain text file StubGenerator.php Class Class source
  Plain text file TestCaseEventsInterface.php Class Class source

  Files folder image Files  /  src  /  TestCase  /  ExpressionLanguage  
File Role Description
  Plain text file ContainsString.php Class Class source
  Plain text file EachItems.php Class Class source
  Plain text file EndsWith.php Class Class source
  Plain text file EqualsTo.php Class Class source
  Plain text file Expression.php Class Class source
  Plain text file ExpressionValidatorInterface.php Class Class source
  Plain text file LessThan.php Class Class source
  Plain text file MoreThan.php Class Class source
  Plain text file StartsWith.php Class Class source
  Plain text file Validators.php Class Class source

  Files folder image Files  /  src  /  TestCase  /  ResponseFilters  
File Role Description
Files folder imageHttpCodes (53 files)
  Plain text file AbstractFilter.php Class Class source
  Plain text file FilterInterface.php Class Class source
  Plain text file FilterTrait.php Class Class source
  Plain text file HasItemFilter.php Class Class source
  Plain text file HasItemsFilter.php Class Class source
  Plain text file HeaderFilter.php Class Class source
  Plain text file HttpCode.php Class Class source
  Plain text file JsonFilter.php Class Class source
  Plain text file JsonPathFilter.php Class Class source

  Files folder image Files  /  src  /  TestCase  /  ResponseFilters  /  HttpCodes  
File Role Description
  Plain text file AbstractPredefinedHttpCode.php Class Class source
  Plain text file HttpAccepted.php Class Class source
  Plain text file HttpBadGateway.php Class Class source
  Plain text file HttpBadRequest.php Class Class source
  Plain text file HttpBandwidthLimitExceeded.php Class Class source
  Plain text file HttpConflict.php Class Class source
  Plain text file HttpConnectionRefused.php Class Class source
  Plain text file HttpConnectionTimedOut.php Class Class source
  Plain text file HttpContinue.php Class Class source
  Plain text file HttpCreated.php Class Class source
  Plain text file HttpExpectationFailed.php Class Class source
  Plain text file HttpForbidden.php Class Class source
  Plain text file HttpFound.php Class Class source
  Plain text file HttpGatewayTimeout.php Class Class source
  Plain text file HttpGone.php Class Class source
  Plain text file HttpHttpVersionNotSupported.php Class Class source
  Plain text file HttpImATeapot.php Class Class source
  Plain text file HttpInsufficientStorage.php Class Class source
  Plain text file HttpInternalServerError.php Class Class source
  Plain text file HttpLengthRequired.php Class Class source
  Plain text file HttpLoopDetected.php Class Class source
  Plain text file HttpMethodNotAllowed.php Class Class source
  Plain text file HttpMovedPermanently.php Class Class source
  Plain text file HttpMultipleChoices.php Class Class source
  Plain text file HttpNetworkAuthenticationRequired.php Class Class source
  Plain text file HttpNoContent.php Class Class source
  Plain text file HttpNonAuthoritativeInformation.php Class Class source
  Plain text file HttpNotAcceptable.php Class Class source
  Plain text file HttpNotExtended.php Class Class source
  Plain text file HttpNotFound.php Class Class source
  Plain text file HttpNotImplemented.php Class Class source
  Plain text file HttpNotModified.php Class Class source
  Plain text file HttpOk.php Class Class source
  Plain text file HttpPartialContent.php Class Class source
  Plain text file HttpPaymentRequired.php Class Class source
  Plain text file HttpPreconditionFailed.php Class Class source
  Plain text file HttpProxyAuthenticationRequired.php Class Class source
  Plain text file HttpRequestedRangeNotSatisfiable.php Class Class source
  Plain text file HttpRequestEntityTooLarge.php Class Class source
  Plain text file HttpRequestTimeout.php Class Class source
  Plain text file HttpRequestUriTooLong.php Class Class source
  Plain text file HttpResetContent.php Class Class source
  Plain text file HttpSeeOther.php Class Class source
  Plain text file HttpServiceUnavailable.php Class Class source
  Plain text file HttpSwitchingProtocols.php Class Class source
  Plain text file HttpSwitchProxy.php Class Class source
  Plain text file HttpTemporaryRedirect.php Class Class source
  Plain text file HttpTooManyRedirects.php Class Class source
  Plain text file HttpUnauthorized.php Class Class source
  Plain text file HttpUnavailableForLegalReasons.php Class Class source
  Plain text file HttpUnsupportedMediaType.php Class Class source
  Plain text file HttpUseProxy.php Class Class source
  Plain text file HttpVariantAlsoNegotiates.php Class Class source

  Files folder image Files  /  src  /  TestCase  /  StatsCollector  
File Role Description
  Plain text file EndContextException.php Class Class source
  Plain text file StatsCollector.php Class Class source
  Plain text file StatsCollectorInterface.php Class Class source

  Files folder image Files  /  src  /  TestCase  /  Stubs  
File Role Description
  Plain text file TestCase.php.stub Class Class source
  Accessible without login Plain text file TestCaseMethod.php.stub Data Auxiliary data

  Files folder image Files  /  src  /  TestCase  /  Traits  
File Role Description
  Plain text file RequestAuthTrait.php Class Class source
  Plain text file RequestMethodsTrait.php Class Class source
  Plain text file RequestTrait.php Class Class source
  Plain text file ResponseHttpCodesTrait.php Class Class source

  Files folder image Files  /  src  /  TestCasePipeline  
File Role Description
Files folder imageAdapters (1 file)
Files folder imageEvents (6 files)
Files folder imageStages (2 files)
  Plain text file Payload.php Class Class source
  Plain text file TestCasePipeline.php Class Class source
  Plain text file TestObject.php Class Class source
  Plain text file TestPipelineConfiguration.php Class Class source
  Plain text file TestSuiteObject.php Class Class source

  Files folder image Files  /  src  /  TestCasePipeline  /  Adapters  
File Role Description
  Plain text file ApiClientRequestAdapter.php Class Class source

  Files folder image Files  /  src  /  TestCasePipeline  /  Events  
File Role Description
  Plain text file AfterTestCaseEvent.php Class Class source
  Plain text file AfterTestCasePipelineEvent.php Class Class source
  Plain text file AfterTestsSuiteEvent.php Class Class source
  Plain text file BeforeTestCaseEvent.php Class Class source
  Plain text file BeforeTestCasePipelineEvent.php Class Class source
  Plain text file BeforeTestsSuiteEvent.php Class Class source

  Files folder image Files  /  src  /  TestCasePipeline  /  Stages  
File Role Description
  Plain text file PrepareTestsSuiteObjectsStage.php Class Class source
  Plain text file RunTestObjectsStage.php Class Class source

  Files folder image Files  /  src  /  Traits  
File Role Description
  Plain text file DirTrait.php Class Class source

  Files folder image Files  /  src  /  Utils  
File Role Description
  Plain text file AbstractResponseItem.php Class Class source
  Plain text file Arr.php Class Class source
  Plain text file MockApiResponseInterface.php Class Class source
  Plain text file ResponseItemsCollection.php Class Class source

  Files folder image Files  /  src  /  Validators  
File Role Description
  Plain text file AbstractValidatorAdapter.php Class Class source
  Plain text file ArrayValidatorAdapter.php Class Class source
  Plain text file DateValidatorAdapter.php Class Class source
  Plain text file EmailValidatorAdapter.php Class Class source
  Plain text file Factory.php Class Class source
  Plain text file FloatValidatorAdapter.php Class Class source
  Plain text file HostnameValidatorAdapter.php Class Class source
  Plain text file IBANValidatorAdapter.php Class Class source
  Plain text file IntValidatorAdapter.php Class Class source
  Plain text file IPValidatorAdapter.php Class Class source
  Plain text file ISBNValidatorAdapter.php Class Class source
  Plain text file LengthValidatorAdapter.php Class Class source
  Plain text file NotEmptyValidatorAdapter.php Class Class source
  Plain text file NumericValidatorAdapter.php Class Class source
  Plain text file RegexValidatorAdapter.php Class Class source
  Plain text file StringValidatorAdapter.php Class Class source
  Plain text file URIValidatorAdapter.php Class Class source
  Plain text file UUIDValidatorAdapter.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imageApiClient (1 file)
Files folder imageLoader (3 files, 1 directory)
Files folder imageTestCase (10 files, 3 directories)
Files folder imageTestCasePipeline (5 files, 3 directories)
Files folder imageTraits (1 file)
Files folder imageUtils (4 files)
Files folder imageValidators (16 files)
  Plain text file GlobalHelperTest.php Class Class source
  Accessible without login Plain text file TestsBootstrap.php Example Example script

  Files folder image Files  /  tests  /  ApiClient  
File Role Description
  Plain text file MockApiClientTest.php Class Class source

  Files folder image Files  /  tests  /  Loader  
File Role Description
Files folder imageSamplePathWithTestsCase (2 files, 1 directory)
  Plain text file PsrClassLoaderTest.php Class Class source
  Plain text file TestCaseDelegateTest.php Class Class source
  Plain text file TestsBagTest.php Class Class source

  Files folder image Files  /  tests  /  Loader  /  SamplePathWithTestsCase  
File Role Description
Files folder imageRec (1 file, 1 directory)
  Plain text file SampleFile.php Class Class source
  Plain text file SampleTest.php Class Class source

  Files folder image Files  /  tests  /  Loader  /  SamplePathWithTestsCase  /  Rec  
File Role Description
Files folder imageRec (1 file)
  Plain text file SampleTest.php Class Class source

  Files folder image Files  /  tests  /  Loader  /  SamplePathWithTestsCase  /  Rec  /  Rec  
File Role Description
  Plain text file SampleTest.php Class Class source

  Files folder image Files  /  tests  /  TestCase  
File Role Description
Files folder imageExpressionLanguage (8 files)
Files folder imageResponseFilters (10 files)
Files folder imageStatsCollector (1 file)
  Plain text file AbstractTestCaseTest.php Class Class source
  Plain text file ChainObjectTest.php Class Class source
  Plain text file ChainTraitTest.php Class Class source
  Plain text file RequestTest.php Class Class source
  Plain text file ResponseFiltersBagTest.php Class Class source
  Plain text file ResponseTest.php Class Class source
  Plain text file SampleTestCase.php Class Class source
  Plain text file StubGeneratorTest.php Class Class source
  Plain text file TestResponseChain.php Class Class source
  Plain text file UnsupportedChain.php Class Class source

  Files folder image Files  /  tests  /  TestCase  /  ExpressionLanguage  
File Role Description
  Plain text file ContainsStringTest.php Class Class source
  Plain text file EachItemsTest.php Class Class source
  Plain text file EndsWithTest.php Class Class source
  Plain text file EqualsToTest.php Class Class source
  Plain text file ExpressionTest.php Class Class source
  Plain text file LessThanTest.php Class Class source
  Plain text file MoreThanTest.php Class Class source
  Plain text file StartsWithTest.php Class Class source

  Files folder image Files  /  tests  /  TestCase  /  ResponseFilters  
File Role Description
  Plain text file FilterTraitTest.php Class Class source
  Plain text file HasItemsTest.php Class Class source
  Plain text file HasItemTest.php Class Class source
  Plain text file HeaderFilterTest.php Class Class source
  Plain text file HttpCodeTest.php Class Class source
  Plain text file HttpPredefinedCodesTest.php Class Class source
  Plain text file JsonFilterTest.php Class Class source
  Plain text file JsonPathFilterTest.php Class Class source
  Plain text file SampleResponseItem.php Class Class source
  Plain text file SampleResponseItemAnother.php Class Class source

  Files folder image Files  /  tests  /  TestCase  /  StatsCollector  
File Role Description
  Plain text file StatsCollectorTest.php Class Class source

  Files folder image Files  /  tests  /  TestCasePipeline  
File Role Description
Files folder imageAdapters (1 file)
Files folder imageEvents (6 files)
Files folder imageStages (3 files)
  Plain text file PayloadTest.php Class Class source
  Plain text file TestCasePipelineTest.php Class Class source
  Plain text file TestObjectTest.php Class Class source
  Plain text file TestPipelineConfigurationTest.php Class Class source
  Plain text file TestSuiteObjectTest.php Class Class source

  Files folder image Files  /  tests  /  TestCasePipeline  /  Adapters  
File Role Description
  Plain text file ApiClientRequestAdapterTest.php Class Class source

  Files folder image Files  /  tests  /  TestCasePipeline  /  Events  
File Role Description
  Plain text file AfterTestCaseEventTest.php Class Class source
  Plain text file AfterTestCasePipelineEventTest.php Class Class source
  Plain text file AfterTestsSuiteEventTest.php Class Class source
  Plain text file BeforeTestCaseEventTest.php Class Class source
  Plain text file BeforeTestCasePipelineEventTest.php Class Class source
  Plain text file BeforeTestsSuiteEventTest.php Class Class source

  Files folder image Files  /  tests  /  TestCasePipeline  /  Stages  
File Role Description
  Plain text file AnotherTestCase.php Class Class source
  Plain text file PrepareTestsSuiteObjectsStageTest.php Class Class source
  Plain text file SampleTestCase.php Class Class source

  Files folder image Files  /  tests  /  Traits  
File Role Description
  Plain text file DriTraitTest.php Class Class source

  Files folder image Files  /  tests  /  Utils  
File Role Description
  Plain text file AbstractResponseItemTest.php Class Class source
  Plain text file ArrTest.php Class Class source
  Plain text file ResponseItemsCollectionTest.php Class Class source
  Plain text file SampleResponseItem.php Class Class source

  Files folder image Files  /  tests  /  Validators  
File Role Description
  Plain text file ArrayValidatorAdapterTest.php Class Class source
  Plain text file DateValidatorAdapterTest.php Class Class source
  Plain text file EmailValidatorAdapterTest.php Class Class source
  Plain text file FactoryTest.php Class Class source
  Plain text file FloatValidatorAdapterTest.php Class Class source
  Plain text file HostnameValidatorAdapterTest.php Class Class source
  Plain text file IBANValidatorAdapterTest.php Class Class source
  Plain text file IntValidatorAdapterTest.php Class Class source
  Plain text file IPValidatorAdapterTest.php Class Class source
  Plain text file ISBNValidatorAdapterTest.php Class Class source
  Plain text file LengthValidatorAdapterTest.php Class Class source
  Plain text file NotEmptyValidatorAdapterTest.php Class Class source
  Plain text file NumericValidatorAdapterTest.php Class Class source
  Plain text file RegexValidatorAdapterTest.php Class Class source
  Plain text file StringValidatorAdapterTest.php Class Class source
  Plain text file URIValidatorAdapterTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:131
This week:0
All time:8,762
This week:503Up