PHP code example of devizzent / codeception-mockserver-helper

1. Go to this page and download the library: Download devizzent/codeception-mockserver-helper 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/ */

    

devizzent / codeception-mockserver-helper example snippets


//You can create expectations before call your application in a test
$I->createMockRequest('{"id": "elastic-get-entity-1", "httpRequest": {...}, "httpResponse": {...}}')
$I->createMockRequest('{"id": "elastic-get-entity-2", "httpRequest": {...}, "httpResponse": {...}}')
$I->createMockRequestFromJsonFile('/root/path/elastic-get-entity-3.json')
$I->sendGet('/applition/endpoint/1');
//After execute our application we can check our mocked HTTP communication
$I->seeMockRequestWasCalled('elastic-get-entity-1');
$I->seeMockRequestWasNotCalled('elastic-get-entity-2');
$I->seeAllRequestWereMatched();
$I->removeMockRequest("elastic-get-entity-2");
$I->removeAllMockRequest();