BrainMonkey

Mocking utility for PHP functions and WordPress plugin API

MIT License

Downloads
7M
Stars
288
Committers
15

Bot releases are hidden (Show)

BrainMonkey - v2.6.1 Latest Release

Published by gmazzap almost 3 years ago

Added

  • Compatibility with PHP 8.1 (props @jrfnl)

Changed

  • Improved QA GitHub action workflow for speed, robustness, compat with PHP 8.1, and start testing for PHP 8.2 (props @jrfnl)
  • Improved doc-block for Filters\has (props @shvlv)
  • Improved documentation for added hooks (props @Idealien)

Fixed

  • Allow for fully-qualified parameter type declarations (props @tfrommen)
  • Fixed ClosureParamStringForm compat with PHP 5.6 (props @jrfnl)
BrainMonkey - v2.6.0

Published by gmazzap almost 4 years ago

Added

  • Added stub for esc_xml(), wp_json_encode, user_trailingslashit(), _n, and _nx (props @jrfnl)

Docs

  • Fix docs for has_action/has_filters (props @coreyworrell)
  • Document newly stubbed WP functions (props @jrfnl)
BrainMonkey - v2.5.0

Published by gmazzap about 4 years ago

Added

  • HooksStorage::hookPriority (internal)

Changed

  • has_filter / has_action return true instead of the added priotity. (See #79 props @widoz)

Fixed

  • See Changed
BrainMonkey - v2.4.2

Published by gmazzap about 4 years ago

Added

Nothing

Changed

  • Moved CI from Travis to GitHub actions
  • Moved PHPUnit cross-version helpers (by @jrfnl) from single tests to their UnitTestCase parent class

Fixed

Nothing

BrainMonkey - v2.4.1

Published by gmazzap about 4 years ago

Added

Nothing.

Changed

  • Improved Documentation
  • Updated DealerDirect Composer plugin props @jrfnl

Fixed

Nothing.

BrainMonkey - v2.4.0

Published by gmazzap almost 5 years ago

Added

  • Stubs for do_action_deprecated and apply_filters_deprecated

Changed

  • Improved Travis workflow, including PHP cross-version compatibility, props @jrfnl
  • Added codecov.io to Travis
  • Improved PHPUnit compatibility across PHP versions, props @jrfnl

Fixed

  • Fixed logic bug in HookStorage::parseArgsToAdd, props @szepeviktor
  • Fix implode argument order (PHP 7.4 compatibility fix), props @jrfnl
  • Many code styling fixes and cleanup, props @jrfnl
BrainMonkey - v2.3.1

Published by gmazzap about 5 years ago

Added

  • Nothing

Changed

  • Nothing

Fixed

  • byDefault needs to be allowed for functions expectations
BrainMonkey - v2.3.0

Published by gmazzap about 5 years ago

Added

  • Actions\expectRemoved and Filters\expectRemoved (see #45)
  • Functions\stubTranslationFunctions()
  • Functions\stubEscapeFunctions()
  • Pre-defined stubs for is_wp_error() and absint
  • Default params handling for added and removed hooks
  • Tests for new features
  • Basic functional tests
  • Docs for new features

Changed

  • Re-structured tests folder and test suites
  • Deleted bootstrap file and rely on autoload-dev only
  • Improved base test class
  • Docs improvements in various files (ses #49)
  • Improved various doc blocks and removed all @throws occurrences

Fixed

  • Minor tests issues
  • End-of-line inconsistencies
BrainMonkey - v2.2.1

Published by gmazzap over 5 years ago

Fixed

  • Make sure that static methods can be passed as string, as this is an acceptable way in PHP to pass a callable. See #47
  • Several docs changing

Added

  • Added Mockery PHPUnit integration to the documentation examples.
  • PHP 7.2 and PHP 7.3 test in Travis
BrainMonkey - v2.2.0

Published by gmazzap almost 7 years ago

Fixed

Nothing

Changed

  • Mockery is now allowed in version range >=0.9 < 0.2. Mockery v1 is compatibe with BM itself, and if it breaks something in the package using BM, it will always be possible restrict the requirement there.

Added

Nothing

BrainMonkey - v2.1.0

Published by gmazzap about 7 years ago

Fixed

  • Compatibility with PHPUnit and Patchwork on autoload.

Changed

  • The file patchwork-loader.php which loads Patchwork, is not loaded from Composer autoload, but manually on setUp() or on first container instantiation, based on what occurs first.

Added

  • Functions\stubs() API method for multiple function definitions.
BrainMonkey - v2.0.3

Published by gmazzap about 7 years ago

Fixed

Nothing

Changed

  • Patchwork is now allowed in 2.* version (was 2.0.*).

Added

Nothing

BrainMonkey - v1.5.0

Published by gmazzap over 7 years ago

Fixed

Nothing

Changed

  • Updated Patchwork to version 2

Added

Nothing

BrainMonkey - v2.0.2

Published by gmazzap over 7 years ago

Fixed

  • Improved apply_filters behavior to fix 100% of cases in #16

Changed

Nothing

Added

Nothing

BrainMonkey - v2.0.0

Published by gmazzap over 7 years ago

Changed

  • [BREAKING] API entry-points are now functions and not methods (also Actions::expectFired() is now Actions\expectDone())
  • [BREAKING] Setup workflow (see https://brain-wp.github.io/BrainMonkey/docs/functions-setup.html and https://brain-wp.github.io/BrainMonkey/docs/wordpress-setup.html)
  • [BREAKING] Default "times" expectation is changed from Mockery default ->zeroOrMoreTimes() to ->atLeast()->once()
  • [BREAKING] Closure string representation that can be used with has_filter / has_action is now changed to include closure arguments and distinguish normal closures from static closures
  • Relaxed callable check: function that requires callable arguments (like add_action / add_filter), does not throw exception if the given supposed-to-be callable is not available (e.g. not mocked function or not loaded class)
  • Updated Patchwork to version 2

Added

Fixed

  • Adding expectations for added filters without returning argument expectation does not break apply_filters default behavior. See #16

Migrating from v1 guide available here: https://brain-wp.github.io/BrainMonkey/docs/migrating-from-v1.html

BrainMonkey - v1.4.2

Published by gmazzap almost 8 years ago

Fixed

  • has_action() / has_filter() can now be called with just hook name and they will return true if the given hook has any callback attached (just like they work in core). See #18

Changed

Nothing

Added

Nothing

BrainMonkey - v1.4.1

Published by gmazzap about 8 years ago

Fixed

  • did_action() / Filters::apllied() now works with hooks that contain special chars

Changed

Nothing

Added

Nothing

BrainMonkey - v1.4.0

Published by gmazzap over 8 years ago

Fixed

  • Hooks::sanitizeHookName() is a static function that was called dynamically

Changed

  • When an undefined function is required to be mocked, it was defined with no body, now it triggers a fatal error if not replaced. See #13

Added

  • CI tests are run for PHP 7
BrainMonkey - v1.3.2

Published by gmazzap over 8 years ago

Fixed

  • Both actions and filters can now be tested for same hook be fired / added more than once with different arguments. See #11

Added

  • PHP requirement (>=5.4) in composer.json

Changed

nothing

BrainMonkey - v1.3.1

Published by gmazzap over 8 years ago

Fixed

  • Path of Patchwork (thanks @stephenharris)
  • not working justEcho() and echoArg()