1. Go to this page and download the library: Download jangregor/phpstan-prophecy 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/ */
jangregor / phpstan-prophecy example snippets
use PHPUnit\Framework;
final class ExampleTest extends Framework\TestCase
{
public function testSomething(): void
{
$prophecy = $this->prophesize(SomeModel::class);
$testDouble = $prophecy->reveal();
// ...
}
}
use PHPUnit\Framework;
final class ExampleTest extends Framework\TestCase
{
public function testSomething(): void
{
$prophecy = $this->prophesize()->willExtend(SomeModel::class);
$testDouble = $prophecy->reveal();
// ...
}
}
use PHPUnit\Framework;
final class ExampleTest extends Framework\TestCase
{
public function testSomething(): void
{
$prophecy = $this->prophesize(SomeModel::class)->willImplement(SomeInterface::class);
$testDouble = $prophecy->reveal();
// ...
}
}
use PHPUnit\Framework;
final class ExampleTest extends Framework\TestCase
{
public function testSomething(): void
{
$prophecy = $this->prophesize(SomeModel::class);
$prophecy
->doubleTheNumber(Argument::is(2))
->willReturn(4);
$testDouble = $prophecy->reveal();
// ...
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.