Download the PHP package andreasindal/limerence without Composer

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

Limerence

Limerence is a BDD/TDD testing library for PHP heavily inspired by mocha and chai.

Installation

Installation through Composer is recommended. To add Limerence to your project, simply run:

$ composer require --dev andreasindal/limerence

And then, to run your tests, run:

$ vendor/bin/limerence

Alternatively, you can install Limerence globally:

$ composer global require andreasindal/limerence

With Limerence installed globally, you can easily run your tests from the root of your project by simply typing limerence.

Content

Usage

Limerence expect you to have all of your tests inside a directory called either test or tests in the root of your project, but you can use how many subdirectories you wish.

Testing

Limerence is very to use, and everything you type will feel natural. There are mainly four functions that are used in a test: test(), describe(), it() and expect(), and they are all used in conjunction to each other.

test()

The test() function defines the boundaries of a test suite.

describe()

The describe() function defines the boundaries of a test case.

it()

The it() function describes the expectation of the test.

expect()

The expect() function makes the assertion.

Example

Dog.php

dogTest.php

Here, we're expecting the Dog object to have a method called makeSound(), and that it returns a string that equals "Woof woof!". If we run the test, we'll get the following output:

Assertions

A wide variety of assertions is available with Limerence.

equal(value)

be(value)

Be can assert the following types: string, number, int, integer, long, bool, boolean, float, double, real, object, array, callable, null, empty, file, writable.

There's also an alias for a to make it look good when the expectation starts with a vowel:

You can also call be($value) directly if a/an doesn't make sense.

(Note that both expect($user->age)->to->be->a('integer') and expect($user->age)->to->be('integer') would still work.)

have(value)

The have method can be used to assert properties and methods of objects.

contain(value|values)

Contain can be used to check if an array contain certain values or keys.

which is the same as

You can also check keys by calling

Contain can be used to check multiple keys/values as well by passing it an array as argument:

Negating

All assertions can be negated by adding not to the assertion chain, and will behave as expected. For example:

or

HTTP Requests

Limerence also includes functionality to test HTTP requests, which can be particularly useful when testing REST APIs. The protocol defaults to http, hostname defaults to localhost, port defaults to 80, request method defaults to GET. Example:

request(method[, endpoint])

expect(status)

The expect function makes an assertion of the response status code.

protocol(protocol)

Sets the protocol of the request. Can be either http or https. Defaults to http.

at(hostname)

Sets the target hostname of the request. Defaults to localhost.

on(port)

Sets the target port of the request. Defaults to 80.

Short hand helpers

There's also short hand functions for GET, POST, PUT, PATCH and DELETE requests, for example:

send(data[, json])

To send data, use the send function. It accepts an array of key/value pairs with the data, and optionally a flag that tells Limerence to send the data as JSON. If you set the json to true, it will automatically include a Content-type: application/json header for you. Example:

with(header, value)

To attach a header to the request, simply use the with function. It takes a key and a value, for example:

end(callback)

The request is dispatched when the end method is called, which accepts a callback. Two variables will be passed to the callback, the first one contains any errors that occurs, and the second one is the Response object. Inside the callback, you should put all of your assertions.

License

MIT.


All versions of limerence 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 andreasindal/limerence contains the following files

Loading the files please wait ....