-
-
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
[Bug][Channel] The hostname resolver does not check for the channel status #13697
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@channels | ||
Feature: Browsing shop on right channel | ||
In order to shop | ||
As a Customer | ||
I want to be redirected to the right channel | ||
|
||
Background: | ||
Given the store operates on a channel named "Default" in "USD" currency and with hostname "127.0.0.1" | ||
And the store also operates on a channel named "Alternative" in "USD" currency and with hostname "127.0.0.1" | ||
And the channel "Default" is disabled | ||
|
||
@ui | ||
Scenario: Browsing shop in active channel | ||
When I visit the homepage | ||
Then I should be on channel "Alternative" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right! |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,4 +96,20 @@ public function shouldSeePluginMainPageWithContent(string $content): void | |
{ | ||
Assert::same($this->pluginMainPage->getContent(), $content); | ||
} | ||
|
||
/** | ||
* @When I visit the homepage | ||
*/ | ||
public function iVisitTheHomepage(): void | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably use |
||
{ | ||
$this->homePage->open(); | ||
} | ||
|
||
/** | ||
* @Then I should be on channel :channel | ||
*/ | ||
public function iShouldBeOnChannel(ChannelInterface $channel): void | ||
{ | ||
Assert::eq($this->homePage->getMetaTitle(), $channel->getName()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# This file is part of the Sylius package. | ||
# (c) Paweł Jędrzejewski | ||
|
||
default: | ||
suites: | ||
ui_channels: | ||
contexts: | ||
- sylius.behat.context.hook.doctrine_orm | ||
|
||
- sylius.behat.context.transform.channel | ||
|
||
- sylius.behat.context.setup.channel | ||
|
||
- sylius.behat.context.ui.channel | ||
filters: | ||
tags: "@channels&&@ui" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,6 @@ public function __construct(ChannelRepositoryInterface $channelRepository) | |
|
||
public function findChannel(Request $request): ?ChannelInterface | ||
{ | ||
return $this->channelRepository->findOneByHostname($request->getHost()); | ||
return $this->channelRepository->findOneEnabledByHostname($request->getHost()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have mixed feelings... because it's a good change, but also kind of a BC Break 💃 Even though the previous implementation was faulty, one could depend on it and we change the behaviour of the class and its cc @lchrusciel There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe you are right, but the current implementation hides a relevant bug. We have an eCommerce with two channels and with two different hosts. After a while, we added another channel with the same hostname as the first but disabled, because that channel should only contain some feed products. After creating the channel the first shop started to show the default Sylius theme and only the products available in the disabled channel. We have deleted the disabled channel, fixed the bug, and then recreated the channel to fix that problem. |
||
} | ||
} |
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 should not be able to browse disabled shop
?