PHP code example of magetest / magento-behat-extension
1. Go to this page and download the library: Download magetest/magento-behat-extension 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/ */
magetest / magento-behat-extension example snippets
# features/bootstrap/FeatureContext.php
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
//
// Require 3rd-party libraries here:
//
// ruct(array $parameters)
{
// Initialize your context here
$this->useContext('admin_user', new AdminUserContext($parameters));
}
}
# features/bootstrap/AdminUserContext.php
use Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\TableNode;
use MageTest\MagentoExtension\Context\MagentoContext;
class AdminUserContext extends MagentoContext
{
}
/**
* @Given /^the following products exist:$/
*/
public function theFollowingProductsExist(TableNode $table)
{
throw new PendingException();
}
# features/bootstrap/AdminUserContext.php
use Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\TableNode;
use MageTest\MagentoExtension\Context\MagentoContext;
class AdminUserContext extends MagentoContext
{
/**
* @Given /^"([^"]*)" has existing reviews$/
*/
public function hasExistingReviews($arg1)
{
throw new PendingException();
}
/**
* @When /^I turn reviews off for "([^"]*)" product$/
*/
public function iTurnReviewsOffForProduct($arg1)
{
throw new PendingException();
}
/**
* @Then /^no review should be displayed for "([^"]*)"$/
*/
public function noReviewShouldBeDisplayedFor($arg1)
{
throw new PendingException();
}
}