Download the PHP package williams/testtube without Composer

On this page you can find all versions of the php package williams/testtube. 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 testtube

TestTube: Unit Testing Framework

TestTube is a lightweight and extensible unit testing framework for PHP. Originally built to support the Xpression library, its design prioritizes flexibility, making it suitable for small to medium-sized projects.

Requirements

Installation

  1. Create a new TestTube project (you can replace 'example' with your desired directory name):

  2. Configure composer.json to autoload the PHP libraries you want to test:

  3. Regenerate autoload files:

Writing Your First Test

Let’s create a simple test for a Calculator class.

  1. Inside the tests directory, create a folder to group your test files (e.g., demo). Create a PHP file for your tests, such as calculator.php:

  2. Define a boot method to instantiate the object(s) required for your tests:

If more than one object is required, return an array containing the objects:

  1. Create a test method. Each test method should take as parameters the objects returned by the boot method. By default, test method names must be camel-cased and start with 'test':

  2. Define the body of the test, using an appropriate assert method:

  3. Run your tests from the project's root directory

Example Output:

  1. Modify the expected value to simulate a failed test:

Re-running the tests will produce:

Once a test file contains more than one test, the output will show both the filename and method name to help pinpoint failures.

Advanced Features

Assertions

TestTube includes several assert methods:

The $failureMessage parameter is optional, and a default message will be generated if omitted.

Custom Test Method Names

If you need non-standard test method names, you can declare them using the $useMethods property. You can also disable automatic detection of test methods starting with "test" by setting $useTestMethods to false:

Templates

To follow the DRY (Don't Repeat Yourself) principle, TestTube allows you to extend from templates stored in the templates directory. For example, to share a boot method across multiple test files:

  1. Create a reusable template:

  2. In your test file, extend this template:

The setup Method

The setup method helps to maintain a separation of concerns between object creation and configuration. It allows for any further customisation of the objects returned by the boot method before each test. Like test methods, it must accept each object returned by boot as a parameter:


All versions of testtube with dependencies

PHP Build Version
Package Version
No informations.
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 williams/testtube contains the following files

Loading the files please wait ....