PHP code example of etel / phpunit-double
1. Go to this page and download the library: Download etel/phpunit-double library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
etel / phpunit-double example snippets
$anotherStub = $this->createStub(AnotherInterface::class);
$anotherStub->method('handle')->willReturnCallback($callback)->seal();
$stub = $this->createStub(SomeInterface::class);
$stub->method('steps')->willReturn(5);
$stub->method('next')->willReturn($anotherStub)->seal();
$stub = $this->createStubConfig(type: SomeInterface::class)
->addMethodReturns(name: 'steps', return: 5)
->addMethodReturns(
name: 'next',
return: $this->createStubConfig(type: AnotherInterface::class)
->addMethodReturnsCallback(name: 'handle', callback: $callback)
->getSealedStub()
)
->getSealedStub();