本文整理匯總了PHP中Magento\Mtf\Fixture\FixtureFactory::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP FixtureFactory::create方法的具體用法?PHP FixtureFactory::create怎麽用?PHP FixtureFactory::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Mtf\Fixture\FixtureFactory
的用法示例。
在下文中一共展示了FixtureFactory::create方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: test
/**
* @param FixtureFactory $fixtureFactory
* @param AssertSuccessfulReadinessCheck $assertReadiness
* @param AssertVersionAndEditionCheck $assertVersionAndEdition
* @param AssertSuccessMessage $assertSuccessMessage
* @param AssertApplicationVersion $assertApplicationVersion
* @param array $upgrade
* @return void
*/
public function test(FixtureFactory $fixtureFactory, AssertSuccessfulReadinessCheck $assertReadiness, AssertVersionAndEditionCheck $assertVersionAndEdition, AssertSuccessMessage $assertSuccessMessage, AssertApplicationVersion $assertApplicationVersion, $upgrade = [])
{
// Create fixture
$upgradeFixture = $fixtureFactory->create('Magento\\Upgrade\\Test\\Fixture\\Upgrade', ['data' => $upgrade]);
$createBackupConfig = array_intersect_key($upgrade, ['optionsCode' => '', 'optionsMedia' => '', 'optionsDb' => '']);
$createBackupFixture = $fixtureFactory->create('Magento\\Upgrade\\Test\\Fixture\\Upgrade', ['data' => $createBackupConfig]);
$version = $upgrade['upgradeVersion'];
$suffix = "( (CE|EE))\$";
$normalVersion = '(0|[1-9]\\d*)';
$preReleaseVersion = "((0(?!\\d+(\\.|\\+|{$suffix}))|[1-9A-Za-z])[0-9A-Za-z-]*)";
$buildVersion = '([0-9A-Za-z][0-9A-Za-z-]*)';
$versionPattern = "/^{$normalVersion}(\\.{$normalVersion}){2}" . "(-{$preReleaseVersion}(\\.{$preReleaseVersion})*)?" . "(\\+{$buildVersion}(\\.{$buildVersion})*)?{$suffix}/";
if (preg_match($versionPattern, $version)) {
preg_match("/(.*){$suffix}/", $version, $matches);
$version = $matches[1];
} else {
$this->fail("Provided version format does not comply with semantic versioning specification. Got '{$version}'");
}
// Authenticate in admin area
$this->adminDashboard->open();
// Open Web Setup Wizard
$this->setupWizard->open();
// Authenticate on repo.magento.com
if ($upgrade['needAuthentication'] === 'Yes') {
$this->setupWizard->getSystemConfig()->clickSystemConfig();
$this->setupWizard->getAuthentication()->fill($upgradeFixture);
$this->setupWizard->getAuthentication()->clickSaveConfig();
$this->setupWizard->open();
}
// Select upgrade to version
$this->setupWizard->getSystemUpgradeHome()->clickSystemUpgrade();
$this->setupWizard->getSelectVersion()->fill($upgradeFixture);
if ($upgrade['otherComponents'] === 'Yes') {
$this->setupWizard->getSelectVersion()->chooseUpgradeOtherComponents();
}
$this->setupWizard->getSelectVersion()->clickNext();
// Readiness Check
$this->setupWizard->getReadiness()->clickReadinessCheck();
$assertReadiness->processAssert($this->setupWizard);
$this->setupWizard->getReadiness()->clickNext();
// Create Backup page
$this->setupWizard->getCreateBackup()->fill($createBackupFixture);
$this->setupWizard->getCreateBackup()->clickNext();
// Check info and press 'Upgrade' button
$assertVersionAndEdition->processAssert($this->setupWizard, $upgrade['package'], $version);
$this->setupWizard->getSystemUpgrade()->clickSystemUpgrade();
$assertSuccessMessage->processAssert($this->setupWizard, $upgrade['package']);
// Check application version
$this->adminDashboard->open();
$assertApplicationVersion->processAssert($this->adminDashboard, $version);
}
示例2: __prepare
/**
* Prepare magento customer for test and delete all tax rules.
*
* @param FixtureFactory $fixtureFactory
* @return array
*/
public function __prepare(FixtureFactory $fixtureFactory)
{
$this->objectManager->create('Mage\\Tax\\Test\\TestStep\\DeleteAllTaxRulesStep')->run();
$magentoCustomer = $fixtureFactory->create('Mage\\Customer\\Test\\Fixture\\Customer', ['dataSet' => 'default']);
$magentoCustomer->persist();
return ['customer' => $magentoCustomer];
}
示例3: __construct
/**
* @constructor
* @param FixtureFactory $fixtureFactory
* @param CheckoutOnepage $checkoutOnepage
* @param array $payment
*/
public function __construct(FixtureFactory $fixtureFactory, CheckoutOnepage $checkoutOnepage, array $payment)
{
if (isset($payment['cc']) && !$payment['cc'] instanceof Cc) {
$payment['cc'] = $fixtureFactory->create('Mage\\Payment\\Test\\Fixture\\Cc', ['dataSet' => $payment['cc']]);
}
$this->payment = $payment;
$this->checkoutOnepage = $checkoutOnepage;
}
示例4: __construct
/**
* @constructor
* @param FixtureFactory $fixtureFactory
* @param CheckoutMultishippingBilling $checkoutMultishippingBilling
* @param array $payment
*/
public function __construct(FixtureFactory $fixtureFactory, CheckoutMultishippingBilling $checkoutMultishippingBilling, array $payment)
{
$this->checkoutMultishippingBilling = $checkoutMultishippingBilling;
if (isset($payment['cc']) && !$payment['cc'] instanceof Cc) {
$payment['cc'] = $fixtureFactory->create('Mage\\Payment\\Test\\Fixture\\Cc', ['dataSet' => $payment['cc']]);
}
$this->payment = $payment;
}
示例5: getProduct
/**
* Get product's fixture.
*
* @param OrderInjectable $order
* @param array $data
* @param int $index [optional]
* @return FixtureInterface
*/
protected function getProduct(OrderInjectable $order, array $data, $index = 0)
{
if (!isset($data['items_data'][$index]['back_to_stock']) || $data['items_data'][$index]['back_to_stock'] != 'Yes') {
return $order->getEntityId()['products'][$index];
}
$product = $order->getEntityId()['products'][$index];
$productData = $product->getData();
$checkoutDataQty = $productData['checkout_data']['qty'];
$productData['quantity_and_stock_status']['qty'] -= $checkoutDataQty - $data['items_data'][$index]['qty'];
$productData = array_diff_key($productData, array_flip($this->skipFields));
return $this->fixtureFactory->create(get_class($product), ['data' => $productData]);
}
示例6: test
/**
* @param FixtureFactory $fixtureFactory
* @param AssertSuccessfulReadinessCheck $assertReadiness
* @param AssertVersionAndEditionCheck $assertVersionAndEdition
* @param AssertSuccessMessage $assertSuccessMessage
* @param AssertApplicationVersion $assertApplicationVersion
* @param array $upgrade
* @return void
*/
public function test(FixtureFactory $fixtureFactory, AssertSuccessfulReadinessCheck $assertReadiness, AssertVersionAndEditionCheck $assertVersionAndEdition, AssertSuccessMessage $assertSuccessMessage, AssertApplicationVersion $assertApplicationVersion, $upgrade = [])
{
// Create fixture
$upgradeFixture = $fixtureFactory->create('Magento\\Upgrade\\Test\\Fixture\\Upgrade', ['data' => $upgrade]);
$createBackupConfig = array_intersect_key($upgrade, ['optionsCode' => '', 'optionsMedia' => '', 'optionsDb' => '']);
$createBackupFixture = $fixtureFactory->create('Magento\\Upgrade\\Test\\Fixture\\Upgrade', ['data' => $createBackupConfig]);
$version = $upgrade['upgradeVersion'];
if (preg_match('/^[0-9].[0-9].[0-9]/', $version, $out)) {
$version = array_shift($out);
}
// Authenticate in admin area
$this->adminDashboard->open();
// Open Web Setup Wizard
$this->setupWizard->open();
// Authenticate on repo.magento.com
if ($upgrade['needAuthentication'] === 'Yes') {
$this->setupWizard->getSystemConfig()->clickSystemConfig();
$this->setupWizard->getAuthentication()->fill($upgradeFixture);
$this->setupWizard->getAuthentication()->clickSaveConfig();
$this->setupWizard->open();
}
// Select upgrade to version
$this->setupWizard->getSystemUpgradeHome()->clickSystemUpgrade();
$this->setupWizard->getSelectVersion()->fill($upgradeFixture);
$this->setupWizard->getSelectVersion()->clickNext();
// Readiness Check
$this->setupWizard->getReadiness()->clickReadinessCheck();
$assertReadiness->processAssert($this->setupWizard);
$this->setupWizard->getReadiness()->clickNext();
// Create Backup page
$this->setupWizard->getCreateBackup()->fill($createBackupFixture);
$this->setupWizard->getCreateBackup()->clickNext();
// Check info and press 'Upgrade' button
$assertVersionAndEdition->processAssert($this->setupWizard, $upgrade['package'], $version);
$this->setupWizard->getSystemUpgrade()->clickSystemUpgrade();
$assertSuccessMessage->processAssert($this->setupWizard, $upgrade['package']);
// Check application version
$this->adminDashboard->open();
$assertApplicationVersion->processAssert($this->adminDashboard, $version);
}
示例7: testLoginAfterChangingPermissions
/**
* @param Role $role
* @param Role $updatedRole
* @param User $user
* @return void
*/
public function testLoginAfterChangingPermissions(Role $role, Role $updatedRole, User $user)
{
/** Create role and a new user with this role */
$role->persist();
/** @var User $user */
$user = $this->fixtureFactory->create('Magento\\User\\Test\\Fixture\\User', ['data' => array_merge($user->getData(), ['role_id' => ['role' => $role]])]);
$user->persist();
/** Change the scope of resources available for the role created earlier */
$filter = ['rolename' => $role->getRoleName()];
$this->userRoleIndex->open();
$this->userRoleIndex->getRoleGrid()->searchAndOpen($filter);
$this->userRoleEditRole->getRoleFormTabs()->fill($updatedRole);
$this->userRoleEditRole->getPageActions()->save();
$this->dashboard->getAdminPanelHeader()->logOut();
}
示例8: assignPromotedProducts
/**
* Assign promoted products.
*
* @param string $promotedProducts
* @param string $type
* @return void
*/
protected function assignPromotedProducts($promotedProducts, $type)
{
$promotedProducts = $this->parsePromotedProducts($promotedProducts);
foreach ($promotedProducts as $productName => $assignedNames) {
$initialProduct = $this->products[$productName];
$filter = ['sku' => $initialProduct->getSku()];
$assignedProducts = [];
foreach ($assignedNames as $assignedName) {
$assignedProducts[] = $this->products[$assignedName];
}
$product = $this->fixtureFactory->create(get_class($initialProduct), ['data' => [$type => ['products' => $assignedProducts]]]);
$this->catalogProductIndex->open();
$this->catalogProductIndex->getProductGrid()->searchAndOpen($filter);
$this->catalogProductEdit->getProductForm()->fill($product);
$this->catalogProductEdit->getFormPageActions()->save();
$this->catalogProductEdit->getMessagesBlock()->waitSuccessMessage();
}
}
示例9: __construct
/**
* @constructor
* @param FixtureFactory $fixtureFactory
* @param array $params [optional]
* @param array $data [optional]
*/
public function __construct(FixtureFactory $fixtureFactory, array $params = [], array $data = [])
{
$this->params = $params;
if (isset($data['presets'])) {
$data['presets'] = explode(',', $data['presets']);
foreach ($data['presets'] as $value) {
/** @var AddressFixture $fixture */
$addresses = $fixtureFactory->create('Mage\\Paypal\\Test\\Fixture\\PaypalAddress', ['dataSet' => $value]);
$this->data[] = $addresses->getData();
$this->addressesFixture[] = $addresses;
}
} elseif (empty($data['presets']) && !empty($data['addresses'])) {
foreach ($data['addresses'] as $addresses) {
/** @var AddressFixture $addresses */
$this->data[] = $addresses->getData();
$this->addressesFixture[] = $addresses;
}
}
}
示例10: test
/**
* Install Magento via web interface.
*
* @param User $user
* @param array $install
* @param array $configData
* @param FixtureFactory $fixtureFactory
* @param AssertAgreementTextPresent $assertLicense
* @param AssertSuccessfulReadinessCheck $assertReadiness
* @return array
*/
public function test(User $user, array $install, array $configData, FixtureFactory $fixtureFactory, AssertAgreementTextPresent $assertLicense, AssertSuccessfulReadinessCheck $assertReadiness)
{
$dataConfig = array_merge($install, $configData);
if ($dataConfig['httpsFront'] != "-") {
$dataConfig['https'] = str_replace('http', 'https', $dataConfig['web']);
}
/** @var InstallConfig $installConfig */
$installConfig = $fixtureFactory->create('Magento\\Install\\Test\\Fixture\\Install', ['data' => $dataConfig]);
// Steps
$this->homePage->open();
// Verify license agreement.
$this->installPage->getLandingBlock()->clickTermsAndAgreement();
$assertLicense->processAssert($this->installPage);
$this->installPage->getLicenseBlock()->clickBack();
$this->installPage->getLandingBlock()->clickAgreeAndSetup();
// Step 1: Readiness Check.
$this->installPage->getReadinessBlock()->clickReadinessCheck();
$assertReadiness->processAssert($this->installPage);
$this->installPage->getReadinessBlock()->clickNext();
// Step 2: Add a Database.
$this->installPage->getDatabaseBlock()->fill($installConfig);
$this->installPage->getDatabaseBlock()->clickNext();
// Step 3: Web Configuration.
$this->installPage->getWebConfigBlock()->clickAdvancedOptions();
$this->installPage->getWebConfigBlock()->fill($installConfig);
$this->installPage->getWebConfigBlock()->clickNext();
// Step 4: Customize Your Store
$this->installPage->getCustomizeStoreBlock()->fill($installConfig);
$this->installPage->getCustomizeStoreBlock()->clickNext();
// Step 5: Create Admin Account.
$this->installPage->getCreateAdminBlock()->fill($user);
$this->installPage->getCreateAdminBlock()->clickNext();
// Step 6: Install.
$this->installPage->getInstallBlock()->clickInstallNow();
return ['installConfig' => $installConfig];
}
示例11: disableSecretKey
/**
* Disable secret key before creating and activating integration.
*
* @return void
*/
protected function disableSecretKey()
{
$config = $this->fixtureFactory->create('Magento\\Config\\Test\\Fixture\\ConfigData', ['dataset' => 'secret_key_disable']);
$config->persist();
}
示例12: createWidget
/**
* Create Widget.
*
* @param string $widget
* @param Banner $banner
* @return BannerWidget
*/
protected function createWidget($widget, Banner $banner)
{
$widget = $this->fixtureFactory->create('Enterprise\\Banner\\Test\\Fixture\\BannerWidget', ['dataSet' => $widget, 'data' => ['parameters' => ['banner_ids' => $banner->getBannerId(), 'display_mode' => 'fixed']]]);
$widget->persist();
return $widget;
}