Book Image

Learning Yii Testing

Book Image

Learning Yii Testing

Overview of this book

Table of Contents (16 chapters)
Learning Yii Testing
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Functional tests for REST interfaces


Up until now, you have seen what's already been implemented, what is possible to do out of the box, and some additional functionalities like the fixtures.

Now let's have a look at what testing a REST interface entails; the default functional tests available in Codeception are executed by PHPBrowser, and the interface exposed to interact with it is quite limited and can only be used to deal and interact with the markup output by the web server. The REST module provided by Codeception is something we would love.

Just to cite a few of the features available, you'll have functions to set and read headers, such as seeHttpHeader() and haveHttpHeader(), and specific methods to call HTTP requests towards our interface, such as sendGET(), sendPUT(), and sendOPTIONS().

Specifically for our interface of the user, our tests will be split into two parts:

  • Tests on the actual functionality—authentication and interaction with the application

  • Some additional tests to ensure...