mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Tests fixes and nullable fields
This commit is contained in:
parent
1185ef8657
commit
0848c16074
9 changed files with 53 additions and 15 deletions
|
|
@ -8,14 +8,14 @@ use Doctrine\Migrations\AbstractMigration;
|
|||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20190109091323 extends AbstractMigration
|
||||
final class Version20190109095211 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||
|
||||
$this->addSql('CREATE TABLE sylius_shop_billing_data (id INT AUTO_INCREMENT NOT NULL, company VARCHAR(255) NOT NULL, taxId VARCHAR(255) NOT NULL, countryCode VARCHAR(255) NOT NULL, street VARCHAR(255) NOT NULL, city VARCHAR(255) NOT NULL, postcode VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE sylius_shop_billing_data (id INT AUTO_INCREMENT NOT NULL, company VARCHAR(255) DEFAULT NULL, taxId VARCHAR(255) DEFAULT NULL, countryCode VARCHAR(255) DEFAULT NULL, street VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, postcode VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE sylius_channel ADD shop_billing_data_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE sylius_channel ADD CONSTRAINT FK_16C8119EB5282EDF FOREIGN KEY (shop_billing_data_id) REFERENCES sylius_shop_billing_data (id) ON DELETE CASCADE');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_16C8119EB5282EDF ON sylius_channel (shop_billing_data_id)');
|
||||
|
|
@ -7,6 +7,7 @@ Feature: Adding a new channel with shop billing data
|
|||
Background:
|
||||
Given the store has currency "Euro"
|
||||
And the store has locale "English (United States)"
|
||||
And the store operates in "United States"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
|
|
|
|||
|
|
@ -49,12 +49,12 @@ final class ShopBillingDataElement extends Element implements ShopBillingDataEle
|
|||
protected function getDefinedElements(): array
|
||||
{
|
||||
return array_merge(parent::getDefinedElements(), [
|
||||
'city' => '#sylius_channel_billingData_city',
|
||||
'company' => '#sylius_channel_billingData_company',
|
||||
'country_code' => '#sylius_channel_billingData_countryCode',
|
||||
'postcode' => '#sylius_channel_billingData_postcode',
|
||||
'street' => '#sylius_channel_billingData_street',
|
||||
'tax_id' => '#sylius_channel_billingData_taxId',
|
||||
'city' => '#sylius_channel_shopBillingData_city',
|
||||
'company' => '#sylius_channel_shopBillingData_company',
|
||||
'country_code' => '#sylius_channel_shopBillingData_countryCode',
|
||||
'postcode' => '#sylius_channel_shopBillingData_postcode',
|
||||
'street' => '#sylius_channel_shopBillingData_street',
|
||||
'tax_id' => '#sylius_channel_shopBillingData_taxId',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ default:
|
|||
contexts_services:
|
||||
- sylius.behat.context.hook.doctrine_orm
|
||||
|
||||
- sylius.behat.context.transform.address
|
||||
- sylius.behat.context.transform.channel
|
||||
- sylius.behat.context.transform.country
|
||||
- sylius.behat.context.transform.currency
|
||||
- sylius.behat.context.transform.locale
|
||||
- sylius.behat.context.transform.shared_storage
|
||||
|
|
@ -15,6 +17,7 @@ default:
|
|||
|
||||
- sylius.behat.context.setup.channel
|
||||
- sylius.behat.context.setup.currency
|
||||
- sylius.behat.context.setup.geographical
|
||||
- sylius.behat.context.setup.locale
|
||||
- sylius.behat.context.setup.payment
|
||||
- sylius.behat.context.setup.admin_security
|
||||
|
|
|
|||
|
|
@ -13,6 +13,14 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||
|
||||
final class ShopBillingDataType extends AbstractType
|
||||
{
|
||||
/** @var string */
|
||||
private $dataClass;
|
||||
|
||||
public function __construct(string $dataClass)
|
||||
{
|
||||
$this->dataClass = $dataClass;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
|
|
@ -27,21 +35,25 @@ final class ShopBillingDataType extends AbstractType
|
|||
->add('countryCode', CountryCodeChoiceType::class, [
|
||||
'label' => 'sylius.form.channel.billing_data.country',
|
||||
'enabled' => true,
|
||||
'required' => false,
|
||||
])
|
||||
->add('street', TextType::class, [
|
||||
'label' => 'sylius.form.channel.billing_data.street',
|
||||
'required' => false,
|
||||
])
|
||||
->add('city', TextType::class, [
|
||||
'label' => 'sylius.form.channel.billing_data.city',
|
||||
'required' => false,
|
||||
])
|
||||
->add('postcode', TextType::class, [
|
||||
'label' => 'sylius.form.channel.billing_data.postcode',
|
||||
'required' => false,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefault('data_class', ShopBillingData::class);
|
||||
$resolver->setDefault('data_class', $this->dataClass);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@
|
|||
<generator/>
|
||||
</id>
|
||||
|
||||
<field name="company" />
|
||||
<field name="taxId" />
|
||||
<field name="countryCode" />
|
||||
<field name="street" />
|
||||
<field name="city" />
|
||||
<field name="postcode" />
|
||||
<field name="company" nullable="true" />
|
||||
<field name="taxId" nullable="true" />
|
||||
<field name="countryCode" nullable="true" />
|
||||
<field name="street" nullable="true" />
|
||||
<field name="city" nullable="true" />
|
||||
<field name="postcode" nullable="true" />
|
||||
</entity>
|
||||
</doctrine-mapping>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
<parameter key="sylius.form.type.product_image.validation_groups" type="collection">
|
||||
<parameter>sylius</parameter>
|
||||
</parameter>
|
||||
<parameter key="sylius.model.shop_billing_data.class">Sylius\Component\Core\Model\ShopBillingData</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
|
|
@ -242,6 +243,7 @@
|
|||
</service>
|
||||
|
||||
<service id="sylius.form.type.shop_billing_data" class="Sylius\Bundle\CoreBundle\Form\Type\ShopBillingDataType">
|
||||
<argument>%sylius.model.shop_billing_data.class%</argument>
|
||||
<tag name="form.type" />
|
||||
</service>
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,16 @@
|
|||
"skippingShippingStepAllowed": {},
|
||||
"skippingPaymentStepAllowed": {},
|
||||
"accountVerificationRequired": {},
|
||||
"shopBillingData": {
|
||||
"children": {
|
||||
"taxId": {},
|
||||
"company": {},
|
||||
"countryCode": {},
|
||||
"street": {},
|
||||
"city": {},
|
||||
"postcode": {}
|
||||
}
|
||||
},
|
||||
"code": {
|
||||
"errors": [
|
||||
"Please enter channel code."
|
||||
|
|
|
|||
|
|
@ -26,6 +26,16 @@
|
|||
"skippingShippingStepAllowed": {},
|
||||
"skippingPaymentStepAllowed": {},
|
||||
"accountVerificationRequired": {},
|
||||
"shopBillingData": {
|
||||
"children": {
|
||||
"taxId": {},
|
||||
"company": {},
|
||||
"countryCode": {},
|
||||
"street": {},
|
||||
"city": {},
|
||||
"postcode": {}
|
||||
}
|
||||
},
|
||||
"code": {},
|
||||
"baseCurrency": {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue