PHP code example of peridot-php / peridot-prophecy-plugin

1. Go to this page and download the library: Download peridot-php/peridot-prophecy-plugin 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/ */

    

peridot-php / peridot-prophecy-plugin example snippets



use Evenement\EventEmitterInterface;
use Peridot\Plugin\Prophecy\ProphecyPlugin;

return function(EventEmitterInterface $emitter) {
    $plugin = new ProphecyPlugin($emitter);
};


describe('Bird', function() {
    it('should fly', function() {
        $mock = $this->getProphet()->prophesize('Bird');
        //do stuff with the mock
    });
});

describe('Vendor\Namespace\Klass', function() {
    it('should have a subject', function() {
        $instance = $this->subject->reveal();
        assert($instance instanceof Klass, 'should be instance of Klass');
    });
});


use Peridot\Plugin\Prophecy\ProphecyScope;

describe('Bird', function() {
    //here we manually mixin the http kernel scope
    $scope = new ProphecyScope();
    $this->peridotAddChildScope($scope);

    it('should fly', function() {
        $mock = $this->getProphet()->prophesize('Bird');
        //do stuff with the mock
    });
});

$ composer