PHP Libraries › phpspec › prophecy PHP library for creating mock objects in tests efficiently and effectively.
Package Description Prophecy is a PHP library that enables developers to create mock objects with a more intuitive and flexible approach. With Prophecy, you can easily mock dependencies, define method calls, and manage return values for testing purposes. It provides a clean and readable syntax for mocking objects, making testing more efficient and productive in your PHP projects.
Classes: Prophecy\PhpDocumentor\ClassTagRetriever Prophecy\PhpDocumentor\ClassAndInterfaceTagRetriever Prophecy\PhpDocumentor\MethodTagRetrieverInterface Prophecy\Util\StringUtil Prophecy\Util\ExportUtil Prophecy\Promise\CallbackPromise Prophecy\Promise\ThrowPromise Prophecy\Promise\PromiseInterface Prophecy\Promise\ReturnArgumentPromise Prophecy\Promise\ReturnPromise Prophecy\Prophecy\ObjectProphecy Prophecy\Prophecy\ProphecySubjectInterface Prophecy\Prophecy\MethodProphecy Prophecy\Prophecy\RevealerInterface Prophecy\Prophecy\Revealer Prophecy\Prophecy\ProphecyInterface Prophecy\Argument Prophecy\Comparator\FactoryProvider Prophecy\Comparator\ClosureComparator Prophecy\Comparator\ProphecyComparator Prophecy\Comparator\Factory Prophecy\Call\Call Prophecy\Call\CallCenter Prophecy\Prophet Prophecy\Argument\Token\AnyValuesToken Prophecy\Argument\Token\ArrayCountToken Prophecy\Argument\Token\CallbackToken Prophecy\Argument\Token\ArrayEveryEntryToken Prophecy\Argument\Token\LogicalAndToken Prophecy\Argument\Token\ObjectStateToken Prophecy\Argument\Token\ApproximateValueToken Prophecy\Argument\Token\AnyValueToken Prophecy\Argument\Token\TokenInterface Prophecy\Argument\Token\InArrayToken Prophecy\Argument\Token\LogicalNotToken Prophecy\Argument\Token\ExactValueToken Prophecy\Argument\Token\ArrayEntryToken Prophecy\Argument\Token\StringContainsToken Prophecy\Argument\Token\TypeToken Prophecy\Argument\Token\IdenticalValueToken Prophecy\Argument\Token\NotInArrayToken Prophecy\Argument\ArgumentsWildcard Prophecy\Doubler\Doubler Prophecy\Doubler\Generator\Node\TypeNodeAbstract Prophecy\Doubler\Generator\Node\Type\IntersectionType Prophecy\Doubler\Generator\Node\Type\ObjectType Prophecy\Doubler\Generator\Node\Type\UnionType Prophecy\Doubler\Generator\Node\Type\TypeInterface Prophecy\Doubler\Generator\Node\Type\BuiltinType Prophecy\Doubler\Generator\Node\Type\SimpleType Prophecy\Doubler\Generator\Node\ReturnTypeNode Prophecy\Doubler\Generator\Node\MethodNode Prophecy\Doubler\Generator\Node\ClassNode Prophecy\Doubler\Generator\Node\ArgumentTypeNode Prophecy\Doubler\Generator\Node\ArgumentNode Prophecy\Doubler\Generator\ReflectionInterface Prophecy\Doubler\Generator\ClassCodeGenerator Prophecy\Doubler\Generator\TypeHintReference Prophecy\Doubler\Generator\ClassCreator Prophecy\Doubler\Generator\ClassMirror Prophecy\Doubler\DoubleInterface Prophecy\Doubler\LazyDouble Prophecy\Doubler\NameGenerator Prophecy\Doubler\CachedDoubler Prophecy\Doubler\ClassPatch\ThrowablePatch Prophecy\Doubler\ClassPatch\ProphecySubjectPatch Prophecy\Doubler\ClassPatch\TraversablePatch Prophecy\Doubler\ClassPatch\SplFileInfoPatch Prophecy\Doubler\ClassPatch\ReflectionClassNewInstancePatch Prophecy\Doubler\ClassPatch\ClassPatchInterface Prophecy\Doubler\ClassPatch\MagicCallPatch Prophecy\Doubler\ClassPatch\DisableConstructorPatch Prophecy\Doubler\ClassPatch\KeywordPatch Prophecy\Exception\InvalidArgumentException Prophecy\Exception\Prophecy\ObjectProphecyException Prophecy\Exception\Prophecy\MethodProphecyException Prophecy\Exception\Prophecy\ProphecyException Prophecy\Exception\Call\UnexpectedCallException Prophecy\Exception\Doubler\ClassNotFoundException Prophecy\Exception\Doubler\ReturnByReferenceException Prophecy\Exception\Doubler\MethodNotFoundException Prophecy\Exception\Doubler\DoublerException Prophecy\Exception\Doubler\ClassMirrorException Prophecy\Exception\Doubler\MethodNotExtendableException Prophecy\Exception\Doubler\InterfaceNotFoundException Prophecy\Exception\Doubler\DoubleException Prophecy\Exception\Doubler\ClassCreatorException Prophecy\Exception\Exception Prophecy\Exception\Prediction\FailedPredictionException Prophecy\Exception\Prediction\PredictionException Prophecy\Exception\Prediction\AggregateException Prophecy\Exception\Prediction\UnexpectedCallsException Prophecy\Exception\Prediction\UnexpectedCallsCountException Prophecy\Exception\Prediction\NoCallsException Prophecy\Prediction\CallPrediction Prophecy\Prediction\CallTimesPrediction Prophecy\Prediction\PredictionInterface Prophecy\Prediction\CallbackPrediction Prophecy\Prediction\NoCallsPrediction Close Previous Versions Code Integration Example Make sure to include the correct namespace and class paths for proper usage.
<?php
// Example from PHPlibraries.com
require_once 'libs/phpspec/prophecy/1.23.0/loader.php';
require_once 'libs/phpspec/prophecy-phpunit/{lib_version}/loader.php';
require_once 'libs/sebastianbergmann/phpunit/12.4.1/loader.php';
use Prophecy\Prophet;
use PHPUnit\Framework\TestCase;
$obj = new Prophet();
echo '✅ Test OK: ' . get_class($obj);
?>
Report a broken download or code We aim to make using PHP packages easier without Composer. If something doesn't work, let us know — we'll fix it promptly.
Community Discussion Ask questions, share tips, or report issues below.