PHP code example of qratorlabs / smocky-phpunit
1. Go to this page and download the library: Download qratorlabs/smocky-phpunit 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/ */
qratorlabs / smocky-phpunit example snippets
public function testSomeTest(): void {
$methodMock = new MockedMethod($this, SomeClass::class, 'someMethod', once());
$methodMock->getMocker()->willReturn(10);
SomeClass::someMethod(); // will return `10`
SomeClass::someMethod(); // will cause error (expectation - one call)
}