Download the PHP package sirbrillig/corretto without Composer

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

Corretto

Corretto is a simple and expressive PHP test runner.

Modeled after mocha, Corretto provides a DSL (domain-specific language) that makes writing tests easy. No need for classes and long function names; just say what your code does in plain words. After all, wouldn't you rather spend most of your time working on code rather than writing tests?

Installing

First you'll need Composer. Then, in your project:

Or, to install globally:

Just make sure your global vendor binaries directory is in your $PATH. See the docs on global installs for more info.

Assertions

Corretto has built-in support for basic assertions:

It also supports expect syntax, which is recommended:

Custom Assertions

Writing custom assertions is easy. Any function that throws an Exception counts as a test failure!

(You can also throw \Corretto\AssertionFailure which will provide slightly less noisy failures.)

To add new methods to expect(), you'll need to create a class that extends Corretto\Expectation. Within the class, add methods that test the value of $this->actual, which is the value passed to expect(). Then pass the class to the function Corretto\extendExpectation().

For example, to add the method toBeFoo(), you would write the following:

It is then possible to use this method in your tests, like this:

Tests

A test is defined by the function it( string $name, callable $callable ). This function is also aliased as test( string $name, callable $callable ) and specify( string $name, callable $callable ).

The callable should be an anonymous function that contains at least one assertion.

You can skip a test by simply omitting its callable, like this:

You can also skip a test by adding the string SKIP as its first argument:

Suites

Tests can be organized into suites using a similar syntax to tests: describe( string $name, callable $callable ). This is also aliased as suite( string $name, callable $callable ) and context( string $name, callable $callable ).

There is a default "root" suite always defined, so tests can exist by themselves.

Suites can be nested as deep as you like.

You can skip all the tests in a suite by adding the string SKIP as its first argument:

Before, After

Suites can each have a before( callable $callable ) which will be called before all the tests are run in that suite. Similarly after( callable $callable ) will be run after all the tests have completed.

There is also beforeEach( callable $callable ) and afterEach( callable $callable ) which run their callables before/after each test in the suite (or any nested suite). These can be used to set up and restore data that is shared between each test.

Passing variables to closures with the use expression in PHP is verbose, and it's likely that this pattern will be used frequently in tests. To make this easier, each test and each beforeEach/afterEach/before/after function receives a shared object that can be used to pass data between functions. Here is that same series of tests with the object used instead of closures.

Runner

The corretto command-line tool is used to execute the tests. It can be provided with a test file or a directory of test files. If no files are provided, it will default to looking for a directory called tests in the current directory.

The tool has several output options called Reporters that can be changed using the -R or --reporter options. The default Reporter is spec but there is also base, which is simpler, and dots which is more like the default output of PHPUnit.

It's possible to write a custom reporter very easily by extending Corretto\Reporters\Base. The Runner will emit events whenever something happens and a reporter can use those events as it likes.

Examples


All versions of corretto with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.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 sirbrillig/corretto contains the following files

Loading the files please wait ....