PHP code example of ns3777k / hoverfly
1. Go to this page and download the library: Download ns3777k/hoverfly 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/ */
ns3777k / hoverfly example snippets
overfly\Client;
use Hoverfly\Model\Response;
class SomeTest
{
private $hoverfly;
public function __construct()
{
$this->hoverfly = new Client(['base_uri' => getenv('HOVERFLY_URL')]);
}
public function _before()
{
$this->hoverfly->deleteJournal();
$this->hoverfly->deleteSimulation();
}
public function testFeature(ApiTester $I)
{
$this->hoverfly->simulate(
$this->hoverfly->buildSimulation()
->serviceExact('test.ru')
->getExact('/test')
->withState('customer', 'individual')
->willReturn(
Response::json(['test' => true])
->setDelay(3000)
->addTransitionsState('step', 'order')
->addTransitionsState('customer', 'individual')
->addRemovesState('basket')
)
);
$I->sendPOST('/api/v1/faq/9999999/dislike', ['comment' => 'test']);
}
}