Download the PHP package michalv8/xpmock without Composer

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

xpmock

Build Status Latest Stable Version Total Downloads

Introduction [in English] [на русском]

!!! New version 1.1.5: multiple improvements

PHPUnit is standard testing framework in PHP world. No wonder - it is nifty. But speaking about way of mocking objects in PHPUnit many people complain on a bit redundant syntax. They suggest many addons for PHPUnit to create mocks like Mockery (I know this is not just addon).

But I am sure PHPUnit has well-developed mocking system. And this project XPMock is a way to simplify this syntax a bit. I need to underline that XPMock doesn't create some own mock objects. XPMock just calls the same PHPUnit methods creating the same native mocks but much simpler.

Write this

instead of that

Tool generates full-functional native PHPUnit mocks.

Syntax short description

Handy reflection methods

Installation

  1. If you don't have composer, install it
  2. Add xpmock to your project

Usage

Option 1. Add trait to existing test case:

OR Option 2. Extend your test case from xpmock's one:

NEW

  1. If you need to create object with some methods and classname doesn't matter, you could easily do it like this:

  2. Mocking static methods
  3. Mocking abstract methods
  4. Brief syntax to create mocks

  5. Special method this() inside each mock gives you possibility to change non-public properties and call non-public methods of mock via Xpmock\Reflection

  6. You can use $this pointer inside your fake methods

  7. It is easy now to create mocks all methods of which return some value, for example null (stub)

  8. Very expected: now it is possible to adjust mocks after creation with magic method mock()

All versions of xpmock with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
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 michalv8/xpmock contains the following files

Loading the files please wait ....