Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MethodProphecy.php

function MethodProphecy::will

Sets custom promise to the prophecy.

Parameters

callable|Promise\PromiseInterface $promise:

Return value

$this

Throws

\Prophecy\Exception\InvalidArgumentException

5 calls to MethodProphecy::will()
MethodProphecy::willReturn in vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php
Sets return promise to the prophecy.
MethodProphecy::willReturnArgument in vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php
Sets return argument promise to the prophecy.
MethodProphecy::willThrow in vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php
Sets throw promise to the prophecy.
MethodProphecy::willYield in vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php
MethodProphecy::__construct in vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php
@internal

File

vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php, line 225

Class

MethodProphecy
Method prophecy.

Namespace

Prophecy\Prophecy

Code

public function will($promise) {
    if (is_callable($promise)) {
        $promise = new Promise\CallbackPromise($promise);
    }
    if (!$promise instanceof Promise\PromiseInterface) {
        throw new InvalidArgumentException(sprintf('Expected callable or instance of PromiseInterface, but got %s.', gettype($promise)));
    }
    $this->bindToObjectProphecy();
    $this->promise = $promise;
    return $this;
}
RSS feed
Powered by Drupal