PHP code example of prodikl / mocktation
1. Go to this page and download the library: Download prodikl/mocktation 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/ */
prodikl / mocktation example snippets
use Mocktation\TestCase;
class ExampleTest extends TestCase {
public function testGetNum(){
/** @var Example|MockObject $mock */
$mock = $this->createMock(Example::class);
$this->assertEquals(5, $mock->getNum(234));
}
}
class Example {
/**
* Accepts an int $num and returns it
*
* @param $num int The num to return
* @return int The example num
*
* @mockReturn 5
*/
public function getNum($num){
return $num;
}
}