Download the PHP package davesweb/mockery-helper without Composer

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

Mockery Helper

A library to help you use Mockery in the best way possible.

Build Status Latest Stable Version Latest Unstable Version License composer.lock

Current stable version: 1.1.0

Installation

Via composer:

Use the --dev option if you only require your test dependencies in developer mode.

Via composer.json file:

You can also add this package directly to your composer.json file. Add the following line to your require block, or require-dev block:

Then run:

Usage

Once you installed the package, you can use the provided trait in your tests:

This traits ensures that your Mockery expectations are enforced, because it expands on the Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration trait. So if you use this trait, calling \Mockery::close() is no longer needed.

Methods

This trait provides the following methods.

method

Signature:

If you need to pass a method name to a Mockery expectation, use this method to do so. This method accepts a callable as its argument, assuring that the method name you want to pass is recognised as such by an IDE. That way, when you refactor your code, the method name is also refactored in your Unit tests.

This method also checks to see if the method actually exists, so you don't make any typos in your method name.

The callable can be passed in the form of 'ClassName::method', [ClassName::class, 'method'] or [$object, 'method'].

The method method returns the name of the method.

Example usage:

mock

Signature:

This is an alias for the Mockery::mock(...$args): MockerInterface call. Check the Mockery documentation on how to use this method.

spy

Signature:

This is an alias for the Mockery::spy(...$args): MockerInterface call. Check the Mockery documentation on how to use this method.

namedMock

Signature:

This is an alias for the Mockery::namedMock(...$args): MockerInterface call. Check the Mockery documentation on how to use this method.

Skipping the check if a method exists.

Sometimes you want to be able to skip the check if a method is actually defined on a class, while still keeping the refactor options. This can happen for instance if you use the magic __call() method to handle some method calls.

In that case you can disable the check by overriding the allowNonExistingMethods property, or setting it in your test:

You can also set the check per method call by adding a second parameter to the method call. Set it to true to enforce the check, even if the global setting is to skip to check. Or set it to false to skip the check just for that method call.

Contributing

Thank you for taking the time to improve this package! If you want to contribute to this package, please read to following file first: Contributing.


All versions of mockery-helper with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.0
mockery/mockery Version ^1.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 davesweb/mockery-helper contains the following files

Loading the files please wait ...