Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Commit

Permalink
custom template for extended product form is no longer needed because…
Browse files Browse the repository at this point in the history
… ProductFormType is rendered in default fashion

- added groups to ProductFormTypeExtension
- tests updated appropriately
  • Loading branch information
Svaťa Šimara committed Sep 25, 2018
1 parent ea72b08 commit 62ae3dd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 333 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ public function __construct(ProductConditionFacade $productConditionFacade)
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('condition', ChoiceType::class, [
$basicInformationGroupBuilder = $builder->get('basicInformationGroup');

$basicInformationGroupBuilder->add('condition', ChoiceType::class, [
'required' => true,
'choices' => $this->productConditionFacade->getAll(),
'label' => t('Condition'),
]);

$builder->remove('flags');
$basicInformationGroupBuilder->remove('flags');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class ProductImageUploadCest
{
const IMAGE_UPLOAD_FIELD_ID = 'product_edit_form_images_file';
const IMAGE_UPLOAD_FIELD_ID = 'product_edit_form_imageGroup_images_file';
const SAVE_BUTTON_NAME = 'product_edit_form[save]';

const EXPECTED_SUCCESS_MESSAGE = 'Product 22" Sencor SLE 22F46DM4 HELLO KITTY modified';
Expand Down
24 changes: 12 additions & 12 deletions tests/ShopBundle/Smoke/NewProductTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ public function testCreateOrEditProduct($relativeUrl)
*/
private function fillForm(Form $form)
{
$nameForms = $form->get('product_edit_form[productData][name]');
$nameForms = $form->get('product_edit_form[name]');
/* @var $nameForms \Symfony\Component\DomCrawler\Field\InputFormField[] */
foreach ($nameForms as $nameForm) {
$nameForm->setValue('testProduct');
}
$form['product_edit_form[productData][catnum]'] = '123456';
$form['product_edit_form[productData][partno]'] = '123456';
$form['product_edit_form[productData][ean]'] = '123456';
$form['product_edit_form[productData][descriptions][1]'] = 'test description';
$form['product_edit_form[productData][price]'] = '10000';
$form['product_edit_form[productData][vat]']->select($this->getReference(VatDataFixture::VAT_ZERO)->getId());
$form['product_edit_form[productData][sellingFrom]'] = '1.1.1990';
$form['product_edit_form[productData][sellingTo]'] = '1.1.2000';
$form['product_edit_form[productData][stockQuantity]'] = '10';
$form['product_edit_form[productData][unit]']->select($this->getReference(UnitDataFixture::UNIT_CUBIC_METERS)->getId());
$form['product_edit_form[productData][availability]']->select($this->getReference(AvailabilityDataFixture::AVAILABILITY_IN_STOCK)->getId());
$form['product_edit_form[productData][basicInformationGroup][catnum]'] = '123456';
$form['product_edit_form[productData][basicInformationGroup][partno]'] = '123456';
$form['product_edit_form[productData][basicInformationGroup][ean]'] = '123456';
$form['product_edit_form[productData][descriptionsGroup][descriptions][1]'] = 'test description';
$form['product_edit_form[productData][pricesGroup][productCalculatedPricesGroup][price]'] = '10000';
$form['product_edit_form[productData][pricesGroup][vat]']->select($this->getReference(VatDataFixture::VAT_ZERO)->getId());
$form['product_edit_form[productData][displayAvailabilityGroup][sellingFrom]'] = '1.1.1990';
$form['product_edit_form[productData][displayAvailabilityGroup][sellingTo]'] = '1.1.2000';
$form['product_edit_form[productData][displayAvailabilityGroup][stockGroup][stockQuantity]'] = '10';
$form['product_edit_form[productData][displayAvailabilityGroup][unit]']->select($this->getReference(UnitDataFixture::UNIT_CUBIC_METERS)->getId());
$form['product_edit_form[productData][displayAvailabilityGroup][availability]']->select($this->getReference(AvailabilityDataFixture::AVAILABILITY_IN_STOCK)->getId());
}

/**
Expand Down

0 comments on commit 62ae3dd

Please sign in to comment.