mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
[Admin] Disable editing base currency exchange rate
This commit is contained in:
parent
b21cb4ea15
commit
d5c130b103
6 changed files with 57 additions and 20 deletions
|
|
@ -1,15 +0,0 @@
|
|||
@managing_currencies
|
||||
Feature: Inability of disabling the base currency
|
||||
In order to always have the base currency available in the store
|
||||
As an Administrator
|
||||
I want to be prevented from disabling the base currency
|
||||
|
||||
Background:
|
||||
Given I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
Scenario:
|
||||
Given the store operates on a single channel
|
||||
And it uses the "USD" currency by default
|
||||
When I want to edit this currency
|
||||
Then I should not be able to disable this currency
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
@managing_currencies
|
||||
Feature: Inability of modifying the base currency
|
||||
In order to always have the base currency available in the store with base exchange rate
|
||||
As an Administrator
|
||||
I want to be prevented from modifying the base currency
|
||||
|
||||
Background:
|
||||
Given I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
Scenario: Being prevented from disabling base currency
|
||||
Given the store operates on a single channel
|
||||
And it uses the "USD" currency by default
|
||||
When I want to edit this currency
|
||||
Then I should not be able to disable this currency
|
||||
|
||||
@ui
|
||||
Scenario: Being prevented from changing base currency exchange rate
|
||||
Given the store operates on a single channel
|
||||
And it uses the "USD" currency by default
|
||||
When I want to edit this currency
|
||||
Then I should not be able to change exchange rate of this currency
|
||||
|
|
@ -140,7 +140,18 @@ final class ManagingCurrenciesContext implements Context
|
|||
{
|
||||
Assert::true(
|
||||
$this->updatePage->canBeDisabled(),
|
||||
'I should not be able to disable this currency'
|
||||
'I should not be able to disable this currency.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should not be able to change exchange rate of this currency
|
||||
*/
|
||||
public function iCannotChangeItsExchangeRate()
|
||||
{
|
||||
Assert::true(
|
||||
$this->updatePage->canHaveExchangeRateChanged(),
|
||||
'I should not be able to change exchange rate of this currency.'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,14 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
|||
return $toggleableElement->hasAttribute('disabled');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function canHaveExchangeRateChanged()
|
||||
{
|
||||
return $this->getElement('exchangeRate')->hasAttribute('disabled');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@ interface UpdatePageInterface extends BaseUpdatePageInterface
|
|||
*/
|
||||
public function canBeDisabled();
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function canHaveExchangeRateChanged();
|
||||
|
||||
/**
|
||||
* @param string $exchangeRate
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -55,10 +55,16 @@ class CurrencyType extends BaseCurrencyType
|
|||
|
||||
$form = $event->getForm();
|
||||
|
||||
$form->add('enabled', 'checkbox', [
|
||||
'label' => 'sylius.form.locale.enabled',
|
||||
'disabled' => true,
|
||||
]);
|
||||
$form
|
||||
->add('enabled', 'checkbox', [
|
||||
'label' => 'sylius.form.locale.enabled',
|
||||
'disabled' => true,
|
||||
])
|
||||
->add('exchangeRate', 'number', [
|
||||
'label' => 'sylius.form.currency.exchange_rate',
|
||||
'disabled' => true,
|
||||
])
|
||||
;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue