PHP code example of austp / peridot-gherkin-plugin

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

    

austp / peridot-gherkin-plugin example snippets

(php)
feature(
    'Some Feature',
    '',
    'In order to...',
    'As a ...',
    'I want to...',
    '',
    'Additional text...',
    background(
        'Given something',
        'And something else',
        function () { /* setup function */ },
        function () { /* optional teardown function */ }
    ),
    scenario(
        'Some scenario',
        '',
        'Given something',
        'When something happens',
        function () {},
        'Then something else happens',
        function () {}
    )
);
(php)
feature(
    'Another Feature',
    isolatedScenario(
        'Some scenario',
        'When something happens',
        function () {
            $this->spy = Mockery::spy('alias:SomeClass');
            makeSomethingHappen();
        },
        'Then something else happens',
        function () {
            $this->spy->shouldHaveReceived('makeSomethingElseHappen');
        }
    )
);

feature(
    'Yet another feature',
    isolatedScenario(
        'Another scenario',
        'When something else happens',
        function () {
            $itHappened = SomeClass::makeSomethingElseHappen();
            $this->itHappened = $itHappened;
        },
        'Then something else should have happened',
        function () {
            assert($this->itHappened === true);
        }
    )
);
(php)
feature(
    'Focus next story feature',
    stories(
        // story definitions,

        focusNextStory(),
        'I want this test to be focused',
        function () {}
    )
);
(php)
feature(
    'Skip next story feature',
    stories(
        // story definitions,

        skipNextStory(),
        'I want this test to be skipped',
        function () {}
    )
);
(php)


t\Plugin\GherkinPlugin;

return function ($emitter) {
    new GherkinPlugin($emitter);
};