Download the PHP package radziuk/php-tt without Composer

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

Install the package

Run tests

Use Laravel integrated runner


Specify the folder

By default the runner uses the "app" folder to look for tests. You can specify a custom folder

Self-test the package

After the package is install you can run the selftest script included in the package

Should input something like this:

Test examples

Simple test, pass "hello" to the function, should return "hello"

Text example #2

Text example #3

Text example #4, passing an array

Text example #5, calling a method on the object before testing

Text example #6, mocking $this->... method

Text example #7, mocking method of a dependency

Text example #8, mocking global functions and methods

Text example #9, mocking a property

Text example #10, mocking anything

Define your test data in a separate file

By default, the runner is looking for tests/php-tt-data folder, so you can create your data files there

Create a data file

In your data file

In your class

Use custom keys in your data file. The default key is the method name.

In your data file

In your class

Use data files to create mocks

In your class

In your data file

Other assertions

Assert exception.

This asserts that the method will throw any exception

This asserts that the method will throw an exception of a certain class

Assert exception contains

This asserts that the method will throw an exception and the message will contain the text

Assert contains & preg

This asserts that the result will contain the specified substring

This asserts that the result will match the specified regular expression

Assert callable

This assertion allows you do define a callable that will handle the result of the method's execution and perform comparison with the expected result

In your tests/php-tt-data/TestData.php

Pass more parameters

In your tests/php-tt-data/TestData.php

Create an alias

In your tests/php-tt-data/TestData.php

Use custom data folder

Increase verbosity of the output

Any 1-digit number is interpreted as verbosity level. You can specify you custom folder and verbosity level like the following:

Create your custom runner

Support of traits

As of version 0.3 the support of trait has been added. During the testing, an anonymous class implementing the trait is initialized. To override this default behaviour you can use @php-tt-use-class

Laravel integration

lararun.php

lararun.php boots your laravel without database, logs and other providers, so in your tests you have access to lots of Laravel functionality, eg. facades, various providers etc Please note that currently lararun.php is in alpha version, and it is highly recommended to mock out all the code that can cause permanent changes to your data

Create your custom Laravel command

In app/Console/Commands/PhpTT.php

In app/Console/Kernel.php

Create your custom assertion (same as alias)

In your tests


All versions of php-tt with dependencies

PHP Build Version
Package Version
Requires php-di/php-di Version ^7.0
nikic/php-parser Version ^5.0
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 radziuk/php-tt contains the following files

Loading the files please wait ....