Download the PHP package toast/acceptance without Composer

On this page you can find all versions of the php package toast/acceptance. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package acceptance

Acceptance

Acceptance tests for the Toast test framework

One notch up from integration tests, acceptance tests should test your entire application. That means actually using a web browser for most web applications.

One could argue that a CLI test is also a form of an acceptance test, with the command line acting as a stand-in for a browser. Semantics, semantics...

Toast is written in PHP which (duh) gets compiled on the server. Websites consist of HTML, CSS and Javascript. Hence, you'll need a headless browser like PhantomJS to run your acceptance tests.

Prerequisites

Install the acceptance module:

Acceptance testing requires Chrome or Chromium Headless to be installed.

Preparing your project

Your project needs to be made Toast-aware. For regular tests we did that via the getenv('TOAST') check; for HTTP calls it is similar. Toast's browser passes this variable as $_COOKIE['TOAST'].

In a central place - this can be any place depending on your project, as long as you're 100% sure every called page will run that bit of code - place a check for these headers and make sure your application understands it's running in test mode if they're set.

So, in test mode, use a mock database etc.

Note: you probably also want to only check this on a development URL - production should of course ignore the $_COOKIE['TOAST'] variable.

The TOAST_CLIENT environment variable is also passed in this manner.

Writing an acceptance test

To write these tests, we'll make use of the Toast\Acceptance\Browser object. This is a wrapper around Headless Chromium PHP with some convenience methods.

The get and post methods on the Browser return a Page object. See the [https://github.com/chrome-php/headless-chromium-php](Headless Chromium documentation) for more info on how to use this.

Posting data

Using the post method requires some additional parameters:

Testing with multiple concurrent users

A handy propery of the Browser object accepting a random session id is the possibility for an acceptance test to actually test interaction between different users of your application. E.g., user John logs in and sends a message to Mary; when Mary opens her message center, she should see the new message.

An acceptance test with multiple users would be implemented something like this:


All versions of acceptance with dependencies

PHP Build Version
Package Version
Requires ext-bz2 Version >=7.0
toast/unit Version ^2.0.0
chrome-php/chrome Version ^1.7
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package toast/acceptance contains the following files

Loading the files please wait ....