本文整理汇总了PHP中Magento\Mtf\Fixture\FixtureFactory类的典型用法代码示例。如果您正苦于以下问题:PHP FixtureFactory类的具体用法?PHP FixtureFactory怎么用?PHP FixtureFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FixtureFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __prepare
/**
* Prepare data.
*
* @param FixtureFactory $fixtureFactory
* @param Customer $customer
* @return array
*/
public function __prepare(FixtureFactory $fixtureFactory, Customer $customer)
{
$product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => '100_dollar_product']);
$product->persist();
$customer->persist();
return ['product' => $product, 'customer' => $customer];
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:14,代码来源:CreateGiftCardAccountEntityTest.php
示例2: __construct
/**
* Constructor
*
* @constructor
* @param FixtureFactory $fixtureFactory
* @param array $data
* @param array $params [optional]
*/
public function __construct(FixtureFactory $fixtureFactory, array $data, array $params = [])
{
$this->params = $params;
$this->data = !isset($data['preset']) ? $data : [];
if (isset($data['preset'])) {
$this->data = $this->getPreset($data['preset']);
if (!empty($data['products'])) {
$this->data['products'] = [];
$this->data['products'] = explode('|', $data['products']);
foreach ($this->data['products'] as $key => $products) {
$this->data['products'][$key] = explode(',', $products);
}
}
}
if (!empty($this->data['products'])) {
$productsSelections = $this->data['products'];
$this->data['products'] = [];
foreach ($productsSelections as $index => $products) {
$productSelection = [];
foreach ($products as $key => $product) {
if ($product instanceof FixtureInterface) {
$productSelection[$key] = $product;
continue;
}
list($fixture, $dataSet) = explode('::', $product);
$productSelection[$key] = $fixtureFactory->createByCode($fixture, ['dataSet' => $dataSet]);
$productSelection[$key]->persist();
$this->data['bundle_options'][$index]['assigned_products'][$key]['search_data']['name'] = $productSelection[$key]->getName();
}
$this->data['products'][] = $productSelection;
}
}
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:41,代码来源:BundleSelections.php
示例3: __prepare
/**
* Create custom admin user and setup configuration.
*
* @param FixtureFactory $fixtureFactory
* @return array
*/
public function __prepare(FixtureFactory $fixtureFactory)
{
$adminUser = $fixtureFactory->createByCode('user', ['dataSet' => 'custom_admin']);
$adminUser->persist();
$this->objectManager->create('Mage\\Core\\Test\\TestStep\\SetupConfigurationStep', ['configData' => 'max_admin_login_failures'])->run();
return ['adminUser' => $adminUser];
}
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:13,代码来源:PreventLockedAdminUserLogInToBackendEntityTest.php
示例4: __construct
/**
* @constructor
* @param FixtureFactory $fixtureFactory
* @param string $data
* @param array $params [optional]
*/
public function __construct(FixtureFactory $fixtureFactory, $data, array $params = [])
{
$this->params = $params;
$explodedData = explode('::', $data);
switch (sizeof($explodedData)) {
case 1:
$this->data = $explodedData[0];
break;
case 3:
list($fixture, $dataset, $field) = $explodedData;
$entity = $fixtureFactory->createByCode($fixture, ['dataset' => $dataset]);
if (!$entity->hasData('id')) {
$entity->persist();
}
$this->data = $entity->getData($field);
$this->entity = $entity;
break;
case 4:
list($fixture, $dataset, $source, $field) = $explodedData;
$entity = $fixtureFactory->createByCode($fixture, ['dataset' => $dataset]);
if (!$entity->hasData('id')) {
$entity->persist();
}
$source = $source == 'product' ? $entity->getEntityId()['products'][0] : $entity->getData($source);
$this->data = $source->getData($field);
$this->entity = $entity;
break;
}
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:35,代码来源:Query.php
示例5: __inject
/**
* Injection data
*
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $editProductPage
* @param Category $category
* @param FixtureFactory $fixtureFactory
* @return void
*/
public function __inject(CatalogProductIndex $productGrid, CatalogProductEdit $editProductPage, Category $category, FixtureFactory $fixtureFactory)
{
$this->product = $fixtureFactory->createByCode('catalogProductVirtual', ['dataset' => 'default', 'data' => ['category_ids' => ['category' => $category]]]);
$this->product->persist();
$this->productGrid = $productGrid;
$this->editProductPage = $editProductPage;
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:UpdateVirtualProductEntityTest.php
示例6: __construct
/**
* @param FixtureFactory $fixtureFactory
* @param array $params
* @param array $data [optional]
*/
public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = [])
{
$this->params = $params;
if (isset($data['dataset'])) {
$productsList = array_map('trim', explode(',', $data['dataset']));
foreach ($productsList as $productData) {
list($fixtureCode, $dataset) = explode('::', $productData);
$this->products[] = $fixtureFactory->createByCode($fixtureCode, ['dataset' => $dataset]);
}
}
if (isset($data['products'])) {
foreach ($data['products'] as $product) {
$this->products[] = $product;
}
}
foreach ($this->products as $product) {
if (!$product->hasData('id')) {
$product->persist();
}
$this->data[] = ['id' => $product->getId(), 'name' => $product->getName(), 'sku' => $product->getSku()];
}
if (isset($data['data'])) {
$this->data = array_replace_recursive($this->data, $data['data']);
}
}
开发者ID:Doability,项目名称:magento2dev,代码行数:30,代码来源:RelatedProducts.php
示例7: __construct
/**
* @constructor
* @param FixtureFactory $fixtureFactory
* @param array $params
* @param array $data
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = [])
{
$this->params = $params;
if (!empty($data['category']) && empty($data['dataset']) && $data['category'] instanceof Category) {
/** @var Category $category */
$category = $data['category'];
if (!$category->hasData('id')) {
$category->persist();
}
$this->data[] = $category->getName();
$this->categories[] = $category;
} elseif (isset($data['dataset'])) {
$datasets = explode(',', $data['dataset']);
foreach ($datasets as $dataset) {
if (trim($dataset) == '-') {
$this->data[] = '';
continue;
}
$category = $fixtureFactory->createByCode('category', ['dataset' => $dataset]);
if (!isset($data['new_category']) || $data['new_category'] !== 'yes') {
$category->persist();
}
/** @var Category $category */
$this->data[] = $category->getName();
$this->categories[] = $category;
}
}
}
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:36,代码来源:CategoryIds.php
示例8: __construct
/**
* @constructor
* @param FixtureFactory $fixtureFactory
* @param array $params
* @param array $data
*/
public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = [])
{
$this->params = $params;
if (!empty($data['category']) && empty($data['presets'])) {
/** @var CatalogCategory $category */
$category = $data['category'];
if (!$category->hasData('id')) {
$category->persist();
}
$this->data[] = $category->getName();
$this->categories[] = $category;
} elseif (isset($data['presets'])) {
$presets = explode(',', $data['presets']);
foreach ($presets as $preset) {
$category = $fixtureFactory->createByCode('catalogCategory', ['dataSet' => $preset]);
$category->persist();
/** @var CatalogCategory $category */
$this->data[] = $category->getName();
$this->categories[] = $category;
}
}
if (!empty($this->categories) && count($this->categories) == 1) {
$this->productCategory = $this->categories[0];
}
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:31,代码来源:CategoryIds.php
示例9: processAssert
/**
* Check whether the attribute filter is displayed on the frontend in Layered navigation.
*
* @param CatalogCategoryView $catalogCategoryView
* @param InjectableFixture $product
* @param CatalogProductAttribute $attribute
* @param CmsIndex $cmsIndex
* @param FixtureFactory $fixtureFactory
* @return void
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, InjectableFixture $product, CatalogProductAttribute $attribute, CmsIndex $cmsIndex, FixtureFactory $fixtureFactory)
{
$fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category_with_anchor', 'data' => ['category_ids' => ['presets' => null, 'category' => $product->getDataFieldConfig('category_ids')['source']->getCategories()[0]]]])->persist();
$cmsIndex->open()->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
$label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
\PHPUnit_Framework_Assert::assertTrue(in_array($label, $catalogCategoryView->getLayeredNavigationBlock()->getFilters()), 'Attribute is absent in layered navigation on category page.');
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:17,代码来源:AssertProductAttributeIsFilterable.php
示例10: __construct
/**
* @param OrderCreateIndex $orderCreateIndex
* @param array $payment
* @param FixtureFactory $fixtureFactory
* @param $creditCardClass
* @param array $creditCard
* @param string $creditCardSave
*/
public function __construct(OrderCreateIndex $orderCreateIndex, array $payment, FixtureFactory $fixtureFactory, $creditCardClass, array $creditCard, $creditCardSave = 'No')
{
$this->orderCreatePage = $orderCreateIndex;
$this->payment = $payment;
$this->creditCard = $fixtureFactory->createByCode($creditCardClass, ['dataset' => $creditCard['dataset']]);
$this->creditCardSave = $creditCardSave;
}
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:SaveCreditCardOnBackendStep.php
示例11: __construct
/**
* @constructor
* @param FixtureFactory $fixtureFactory
* @param DataInterface $configuration
* @param array $params
* @param array|string $data [optional]
*/
public function __construct(FixtureFactory $fixtureFactory, DataInterface $configuration, array $params, $data = [])
{
$this->params = $params;
$this->configuration = $configuration;
if (!isset($data['dataSet']) && !isset($data['tax_product_class'])) {
$this->data = $data;
return;
}
if (isset($data['dataSet'])) {
$this->taxClass = $fixtureFactory->createByCode('taxClass', ['dataSet' => $data['dataSet']]);
$this->data = $this->taxClass->getClassName();
if (!$this->taxClass->hasData('id')) {
$this->taxClass->persist();
}
}
if (isset($data['tax_product_class']) && $data['tax_product_class'] instanceof FixtureTaxClass) {
$this->taxClass = $data['tax_product_class'];
$this->data = $this->taxClass->getClassName();
}
if ($this->taxClass->hasData('id')) {
$this->taxClassId = $this->taxClass->getId();
} else {
$this->setTaxClassId($this->data);
}
}
开发者ID:cewolf2002,项目名称:magento,代码行数:32,代码来源:TaxClass.php
示例12: __inject
/**
* Filling objects of the class
*
* @param CatalogProductIndex $catalogProductIndexNewPage
* @param CatalogProductEdit $catalogProductEditPage
* @param FixtureFactory $fixtureFactory
* @return void
*/
public function __inject(CatalogProductIndex $catalogProductIndexNewPage, CatalogProductEdit $catalogProductEditPage, FixtureFactory $fixtureFactory)
{
$this->product = $fixtureFactory->createByCode('downloadableProduct', ['dataset' => 'default']);
$this->product->persist();
$this->catalogProductIndex = $catalogProductIndexNewPage;
$this->catalogProductEdit = $catalogProductEditPage;
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:UpdateDownloadableProductEntityTest.php
示例13: __construct
/**
* @constructor
* @param RepositoryFactory $repositoryFactory
* @param FixtureFactory $fixtureFactory
* @param array $params
* @param array $data [optional]
*/
public function __construct(RepositoryFactory $repositoryFactory, FixtureFactory $fixtureFactory, array $params, array $data = [])
{
$this->params = $params;
if (isset($data['dataset']) && isset($this->params['repository'])) {
$datasets = $repositoryFactory->get($this->params['repository'])->get($data['dataset']);
foreach ($datasets as $dataset) {
list($fixtureCode, $dataset) = explode('::', $dataset);
$this->products[] = $fixtureFactory->createByCode($fixtureCode, ['dataset' => $dataset]);
}
}
if (isset($data['products'])) {
foreach ($data['products'] as $product) {
$this->products[] = $product;
}
}
foreach ($this->products as $product) {
if (!$product->hasData('id')) {
$product->persist();
}
$this->data[] = ['entity_id' => $product->getId(), 'name' => $product->getName(), 'sku' => $product->getSku()];
}
if (isset($data['data'])) {
$this->data = array_replace_recursive($this->data, $data['data']);
}
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:32,代码来源:RelatedProducts.php
示例14: __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];
}
开发者ID:cewolf2002,项目名称:magento,代码行数:13,代码来源:AbstractCreateSalesEntityForOnlinePaymentMethodsTest.php
示例15: __prepare
/**
* Prepare environment for test.
*
* @param FixtureFactory $fixtureFactory
* @return void
*/
public function __prepare(FixtureFactory $fixtureFactory)
{
// Delete existing tax rules.
$this->objectManager->create('Mage\\Tax\\Test\\TestStep\\DeleteAllTaxRulesStep')->run();
// Create US tax rule
$taxRule = $fixtureFactory->createByCode('taxRule', ['dataSet' => 'us_tax_rule']);
$taxRule->persist();
}
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:14,代码来源:CreateOrderWithPayPalStandardTest.php
示例16: __construct
/**
* @constructor
* @param OrderCreateIndex $orderCreateIndex
* @param array $payment
* @param FixtureFactory $fixtureFactory
* @param string $creditCardClass
* @param array|CreditCard|null $creditCard
*/
public function __construct(OrderCreateIndex $orderCreateIndex, array $payment, FixtureFactory $fixtureFactory, $creditCardClass = 'credit_card', array $creditCard = null)
{
$this->orderCreateIndex = $orderCreateIndex;
$this->payment = $payment;
if (isset($creditCard['dataset'])) {
$this->creditCard = $fixtureFactory->createByCode($creditCardClass, ['dataset' => $creditCard['dataset']]);
}
}
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:16,代码来源:SelectPaymentMethodForOrderStep.php
示例17: __construct
/**
* @constructor
* @param FixtureFactory $fixtureFactory
* @param array $params
* @param array $data [optional]
*/
public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = [])
{
$this->params = $params;
if (isset($data['dataSet'])) {
$address = $fixtureFactory->createByCode('address', ['dataSet' => $data['dataSet']]);
$this->data = $address->getData();
}
}
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:14,代码来源:Address.php
示例18: __construct
/**
* @constructor
* @param CheckoutOnepage $checkoutOnepage
* @param array $payment
* @param FixtureFactory $fixtureFactory
* @param string $creditCardClass
* @param array|CreditCard|null $creditCard
*/
public function __construct(CheckoutOnepage $checkoutOnepage, array $payment, FixtureFactory $fixtureFactory, $creditCardClass = 'credit_card', $creditCard = null)
{
$this->checkoutOnepage = $checkoutOnepage;
$this->payment = $payment;
if (isset($creditCard['dataset'])) {
$this->creditCard = $fixtureFactory->createByCode($creditCardClass, ['dataset' => $creditCard['dataset']]);
}
}
开发者ID:Doability,项目名称:magento2dev,代码行数:16,代码来源:SelectPaymentMethodStep.php
示例19: __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;
}
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:14,代码来源:SelectPaymentMethodWithMultishippingStep.php
示例20: test
/**
* Create order with PayPal standard test.
*
* @param FixtureFactory $fixtureFactory
* @return void
*/
public function test(FixtureFactory $fixtureFactory)
{
// Preconditions:
// Create US tax rule. @TODO: Move to __prepare() after implementing MAGETWO-29331.
$taxRule = $fixtureFactory->createByCode('taxRule', ['dataSet' => 'us_tax_rule']);
$taxRule->persist();
$this->executeScenario();
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:14,代码来源:CreateOrderWithPayPalStandardTest.php
注:本文中的Magento\Mtf\Fixture\FixtureFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论