WP_Mock
  • Getting Started
    • Introduction
    • Installation
    • Configuration
  • Usage
    • Mocking WordPress Functions
    • Mocking WordPress Hooks
    • Mocking WordPress Objects
    • Mocking WordPress Constants
  • Tools
    • WP_Mock Test Case
Powered by GitBook
On this page
  • Requirements
  • Install WP_Mock
  • Dependencies
  1. Getting Started

Installation

PreviousIntroductionNextConfiguration

Last updated 1 year ago

Requirements

  • PHP 7.4+

  • Composer 2.0+

Install WP_Mock

Add WP_Mock as a dev-dependency using Composer:

composer require --dev 10up/wp_mock

Dependencies

WP_Mock needs the following dependencies to work:

  • PHPUnit ^9.5 (BSD 3-Clause license)

  • Mockery ^1.6 (BSD 3-Clause license)

  • Patchwork ^2.1 (MIT license)

They will be installed for you by Composer.

Next, you will need to configure PHPUnit first before enabling WP_Mock. for this step.

You will also need to to use it in your tests.

Consult PHPUnit documentation
configure WP_Mock with a bootstrap file