Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Callmap Laravel Package

bovigo/callmap

Stub and mock PHP method and function calls via a callmap. Define fixed returns, callbacks, consecutive results, or thrown exceptions, then verify invocations and arguments. Works with any unit test framework; argument checks via bovigo/assert or PHPUnit.

View on GitHub
Deep Wiki
Context7
v9.1.0
  • implemented #120 Allow methods returning void or never to be mocked to throw an Exception
v9.0.0
  • Removed support for argument verification with xp-framework/unittest, library was discontinued in 2023
  • Postponed removal of support for methods and functions without a return type declaration to 10.0.0, is still supported with 9.0.0
  • Ensured compatibility with phpunit/phpunit 12.4 while keeping compatibility with the predecessor version 11.5
v8.1.0
  • Raised minimum required PHP version to 8.3.0
  • Deprecated support for argument verification with xp-framework/unittest, will be removed with 9.0.0, library was discontinued in 2023
v8.0.6
  • Fixed optional nullable parameters with another case
v8.0.5
  • Restrict deprecated support for methods and functions without a return type to user-defined methods and functions
  • Added #[\ReturnTypeWillChange] to generated proxy methods if a PHP-internal class is mocked to prevent deprecation notices, as their return types available via reflection are not always up to date, e.g. for \XSLTProcessor where reflection delivers no return type information for the single methods of this class
v8.0.4
  • Fixed bug with non-optional nullable parameters
v8.0.3
  • Prevent deprecation notice when calling get_parent_class() in generated proxy
  • Replace deprecated call of is_callable(['parent', $someMethod])
v8.0.2
  • Added proper return type hints to bovigo\callmap\FunctionProxy::returns() and bovigo\callmap\FunctionProxy::throws() so the instance is further recognized as a callable.
v8.0.1
  • Provide more details about mocked method/function in deprecation notice when method or function doesn't have a return type declaration.
  • Improve support for mocking \IteratorAggregate by providing specific return type information, as reflection doesn't provide a return type for \IteratorAggregate::getIterator().
v8.0.0

HEADS UP

  • Raised minimum required PHP version to 8.2
  • Deprecated support for methods and functions without a return type declaration, will be removed with 9.0.0. In case no sensible return type can be specified a "mixed" return type continues to be supported. Starting with 9.0.0, providing a callmap to returns() containing methods that don't have a return type declaration will result in an InvalidArgumentException.

Other changes

  • Added support for return type never
v7.0.0
  • Raised minimum required PHP version to 8.0
  • Added support for intersection types
  • Added support for combined union and intersection types
v6.2.1

This release patches the usage of the deprecated \ReflectionParam::getClass

v6.2.0
  • Ensured compatibility with PHP 8 (#14)
    • Added support for union types
    • Added support for mixed type hint
    • Added support for static return type hint
  • Ensured compatibility with PHPUnit 9.2 and later
v6.1.0
  • Verifications (verify()->wasCalled*(), verify()->receivedNothing()) now increase assertion counter of PHPUnit
v6.0.0

HEADS UP

  • raised minimum required PHP version to 7.3.0

Other changes

  • fixed handling of return values from PHPUnit constraints in argument verification
v5.2.1
  • changed return type hint of NewCallable::of() and NewCallable::stub() to callable&\bovigo\callmap\FunctionProxy
v5.2.0
  • added phpstan annotations so instances created with bovigo\callmap\NewInstance::of() and bovigo\callmap\NewInstance::stub() have the proper intersection type
v5.1.0
  • added bovigo\callmap\ClassProxy::stub(string ...$methods) to allow stubbing of methods on a proxy instance that otherwise forwards method calls to the original class
  • fixed bug that optional return type hints with builtin types aren't optional any more in mock instances
v5.0.2
  • fixed bug that optional return type hints aren't optional any more in mock instances
v5.0.1
  • prevent deprecation notice in PHP 7.4 by using proper methods
v5.0.0

HEADS UP

  • raised minimum required PHP version to 7.2.0
  • removed bovigo\callmap\ClassProxy::mapCalls() and bovigo\callmap\FunctionProxy::mapCall(), deprecated since 3.2.0

Other changes

  • lots of code cleanups
v4.0.1
  • fixed invalid handling of methods and functions with return type declared as void
v4.0.0

BC breaks

  • raised minimum required PHP version to 7.1.0
  • ensured compatibility with PHPUnit 6.x
v3.2.0

HEADS UP

  • added bovigo\callmap\ClassProxy::returns(), bovigo\callmap\ClassProxy::mapCalls() is now an alias for this and should be considered deprecated
  • added bovigo\callmap\FunctionProxy::returns(), bovigo\callmap\FunctionProxy::mapCall() is now an alias for this and should be considered deprecated

Other changes

* added `bovigo\callmap\FunctionProxy::throws()`
v3.1.1
  • removed usage of call_user_func_array(), instead call functions and methods directly
  • added shortcut to prevent iterating over implemented interfaces and parent classes when no return type for a method can be detected
  • minor doc comment fixes
v3.1.0
  • introduced possibility to mock functions as callable, see Mocking injected functions
  • bovigo\callmap\throws() now accepts all instances of \Throwable, not just \Exception
v3.0.3
  • fixed bug that optional string arguments with default values where generated wrong in callmap proxy
v3.0.2
  • fixed bug that return type hint self was not used correctly and lead to a fatal error when creating callmap instances of interfaces or classes using such a return type hint
v3.0.1
  • switch recommendation from xp-framework/core to xp-framework/unittest
v3.0.0

BC breaks

  • raised minimum required PHP version to 7.0.0
  • introduced scalar type hints and strict type checking
  • bovigo\callmap\NewInstance::of() and bovigo\callmap\NewInstance::stub() now throw a bovigo\callmap\ProxyCreationFailure instead of \ReflectionException when creation of proxy fails

Other changes

  • added support for scalar type hints
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport