b374k
m1n1 1.01
Apache/2.4.41 (Ubuntu)
Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64
uid=33(www-data) gid=33(www-data) groups=33(www-data)
server ip : 62.171.164.128 | your ip : 127.0.0.1
safemode OFF
 >  / home / dev2.destoffenstraat.com / vendor / phpspec / prophecy / src / Prophecy / Prediction /
Filename/home/dev2.destoffenstraat.com/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallPrediction.php
Size2.33 kb
Permissionrw-r--r--
Ownerroot : root
Create time17-Aug-2025 10:26
Last modified05-Mar-2020 16:02
Last accessed23-Aug-2025 03:56
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
<?php

/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Prophecy\Prediction;

use Prophecy\Call\Call;
use Prophecy\Prophecy\ObjectProphecy;
use Prophecy\Prophecy\MethodProphecy;
use Prophecy\Argument\ArgumentsWildcard;
use Prophecy\Argument\Token\AnyValuesToken;
use Prophecy\Util\StringUtil;
use Prophecy\Exception\Prediction\NoCallsException;

/**
* Call prediction.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class CallPrediction implements PredictionInterface
{
private $util;

/**
* Initializes prediction.
*
* @param StringUtil $util
*/
public function __construct(StringUtil $util = null)
{
$this->util = $util ?: new StringUtil;
}

/**
* Tests that there was at least one call.
*
* @param Call[] $calls
* @param ObjectProphecy $object
* @param MethodProphecy $method
*
* @throws \Prophecy\Exception\Prediction\NoCallsException
*/
public function check(array $calls, ObjectProphecy $object, MethodProphecy $method)
{
if (count($calls)) {
return;
}

$methodCalls = $object->findProphecyMethodCalls(
$method->getMethodName(),
new ArgumentsWildcard(array(new AnyValuesToken))
);

if (count($methodCalls)) {
throw new NoCallsException(sprintf(
"No calls have been made that match:\n".
" %s->%s(%s)\n".
"but expected at least one.\n".
"Recorded `%s(...)` calls:\n%s",

get_class($object->reveal()),
$method->getMethodName(),
$method->getArgumentsWildcard(),
$method->getMethodName(),
$this->util->stringifyCalls($methodCalls)
), $method);
}

throw new NoCallsException(sprintf(
"No calls have been made that match:\n".
" %s->%s(%s)\n".
"but expected at least one.",

get_class($object->reveal()),
$method->getMethodName(),
$method->getArgumentsWildcard()
), $method);
}
}