-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API] [Exchange Rate] Add api configuration and tests #11178
Conversation
Tomanhez
commented
Mar 5, 2020
•
edited
edited
Q | A |
---|---|
Branch? | api |
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
License | MIT |
44fb232
to
16f3952
Compare
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
16f3952
to
69f050c
Compare
f39f7ce
to
3b39518
Compare
*/ | ||
public function iWantToEditThisExchangeRate(ExchangeRateInterface $exchangeRate): void | ||
{ | ||
$this->sharedStorage->set('exchange_rate_id', $exchangeRate->getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it's not the same step as the one below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you share the answer to Mateusz question?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because after this step I must repeat twice all flow from PUT request to check field immutablity in this two steps: https://github.com/Sylius/Sylius/blob/master/features/currency/managing_exchange_rates/editing_exchange_rate.feature#L23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it doesn't change anything, I would be for merging these two steps because now, this step is confusing to me
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
3b39518
to
e9cb5c2
Compare
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
a9ed475
to
00790a2
Compare
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
*/ | ||
public function iWantToEditThisExchangeRate(ExchangeRateInterface $exchangeRate): void | ||
{ | ||
$this->sharedStorage->set('exchange_rate_id', $exchangeRate->getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you share the answer to Mateusz question?
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
00790a2
to
1bfbb84
Compare
*/ | ||
public function iWantToEditThisExchangeRate(ExchangeRateInterface $exchangeRate): void | ||
{ | ||
$this->sharedStorage->set('exchange_rate_id', $exchangeRate->getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it doesn't change anything, I would be for merging these two steps because now, this step is confusing to me
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Context/Api/Admin/ManagingExchangeRatesContext.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/ExchangeRate.xml
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/ApiBundle/Resources/config/serializer/ExchangeRate.xml
Outdated
Show resolved
Hide resolved
1bfbb84
to
a52b254
Compare
src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/ExchangeRate.xml
Outdated
Show resolved
Hide resolved
a52b254
to
48fe5b4
Compare
48fe5b4
to
7d193e3
Compare
@@ -123,14 +123,14 @@ public function countCollectionItems(): int | |||
return (int) $this->getResponseContentValue('hydra:totalItems'); | |||
} | |||
|
|||
public function getCollection(): array | |||
public function getCollectionItems(): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure about this change :D 💃
public function iDeleteTheExchangeRateBetweenAnd(CurrencyInterface $sourceCurrency, CurrencyInterface $targetCurrency) : void | ||
{ | ||
/** @var ExchangeRateInterface */ | ||
$exchangeRate = $this->getExchangeRateBetweenCurrencies($sourceCurrency->getCode(), $targetCurrency->getCode()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder, maybe we can do it with transform context? It would be wonderful to not have any repositories in the main contexts 🖖
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its good idea, we don't have transform for ExchangeRate yet, but I can make it
public function iShouldSeeASingleExchangeRateInTheList(): void | ||
{ | ||
$this->client->index('exchange_rates'); | ||
Assert::count($this->client->getCollectionItems(), 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not countCollectionItems
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it after : #11178 (comment)
$exchangeRate->getTargetCurrency() | ||
), | ||
sprintf( | ||
'Exchange rate with ratio %s between %s and %s still exists', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still exists
-> exists, but it should not.
? We don't know is it "still" or not 😄
Thank you, Tomasz! 🥇 |
This PR was merged into the api branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | api | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | License | MIT This PR based on #11178 <img width="969" alt="Screenshot 2020-03-10 at 11 15 10" src="https://user-images.githubusercontent.com/39232096/76302525-725a8800-62c0-11ea-8190-86ed67a81548.png"> <!-- - Bug fixes must be submitted against the 1.6 branch (the lowest possible) - Features and deprecations must be submitted against the master branch - Make sure that the correct base branch is set --> Commits ------- a5a0fef Add behat contexts for api ExchangeRates 291852a Add behat configurations c60cf88 Add test for filters 21c56e5 Add filter for currencies b30cfc6 Add fixes and ExchangeRate transform
Part of #11250 |