1. Go to this page and download the library: Download eloquent/phony 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/ */
eloquent / phony example snippets
use function Eloquent\Phony\mock;
$handle = mock('ClassA');
$handle->methodA->with('argument')->returns('value');
$mock = $handle->get();
assert($mock->methodA('argument') === 'value');
$handle->methodA->calledWith('argument');
use function Eloquent\Phony\Kahlan\mock;
describe('Phony', function () {
it('integrates with Kahlan', function () {
$handle = mock('ClassA');
$handle->methodA->with('argument')->returns('value');
$mock = $handle->get();
expect($mock->methodA('argument'))->toBe('value');
$handle->methodA->calledWith('argument');
});
});
use function Eloquent\Phony\Kahlan\on;
describe('Phony for Kahlan', function () {
it('supports auto-wiring', function (ClassA $mock) {
$handle = on($mock);
$handle->methodA->with('argument')->returns('value');
expect($mock->methodA('argument'))->toBe('value');
$handle->methodA->calledWith('argument');
});
});
use function Eloquent\Phony\mock;
describe('Phony', function () {
it('integrates with Peridot', function () {
$handle = mock('ClassA');
$handle->methodA->with('argument')->returns('value');
$mock = $handle->get();
expect($mock->methodA('argument'))->to->equal('value');
$handle->methodA->calledWith('argument');
});
});
use function Eloquent\Phony\on;
describe('Phony for Peridot', function () {
it('supports auto-wiring', function (ClassA $mock) {
$handle = on($mock);
$handle->methodA->with('argument')->returns('value');
expect($mock->methodA('argument'))->to->equal('value');
$handle->methodA->calledWith('argument');
});
});
use Eloquent\Phony\Phpunit\Phony;
class PhonyTest extends PHPUnit_Framework_TestCase
{
public function testIntegration()
{
$handle = Phony::mock('ClassA');
$handle->methodA->with('argument')->returns('value');
$mock = $handle->get();
$this->assertSame('value', $mock->methodA('argument'));
$handle->methodA->calledWith('argument');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.