-
Notifications
You must be signed in to change notification settings - Fork 9.4k
magento/magento2#39169: Special Price To Date is wrongly validated on applySpecialPrice #39690
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
Open
KrasnoshchokBohdan
wants to merge
12
commits into
magento:2.4-develop
Choose a base branch
from
KrasnoshchokBohdan:fix-for-issue-39169
base: 2.4-develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9111182
magento/magento2#39169: Special Price To Date is wrongly validated on…
KrasnoshchokBohdan 364b4e5
Merge branch '2.4-develop' into fix-for-issue-39169
KrasnoshchokBohdan 2a9dec5
Merge branch '2.4-develop' into fix-for-issue-39169
engcom-Hotel 131815c
magento/magento2#39169: Special Price To Date is wrongly validated on…
KrasnoshchokBohdan 0d8b6b0
magento/magento2#39169: Special Price To Date is wrongly validated on…
KrasnoshchokBohdan c8c8b35
Merge branch '2.4-develop' into fix-for-issue-39169
KrasnoshchokBohdan e79e0fa
magento/magento2#39169: Special Price To Date is wrongly validated on…
KrasnoshchokBohdan 0e95cd4
magento/magento2#39169: Special Price To Date is wrongly validated on…
KrasnoshchokBohdan 1ce9b74
Merge branch '2.4-develop' into fix-for-issue-39169
KrasnoshchokBohdan a3fe48c
magento/magento2#39169: Special Price To Date is wrongly validated on…
KrasnoshchokBohdan 7f6699e
Merge branch '2.4-develop' into fix-for-issue-39169
KrasnoshchokBohdan 3a45985
Merge branch '2.4-develop' into fix-for-issue-39169
KrasnoshchokBohdan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/TimezoneScopeTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<?php | ||
declare(strict_types=1); | ||
/** | ||
* Copyright 2015 Adobe | ||
* All Rights Reserved. | ||
*/ | ||
|
||
namespace Magento\Framework\Stdlib\Test\Unit\DateTime; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Framework\App\ScopeInterface; | ||
use Magento\Framework\App\ScopeResolverInterface; | ||
use Magento\Framework\Locale\ResolverInterface; | ||
use Magento\Framework\Stdlib\DateTime; | ||
use Magento\Framework\Stdlib\DateTime\Intl\DateFormatterFactory; | ||
use Magento\Framework\Stdlib\DateTime\Timezone; | ||
use PHPUnit\Framework\MockObject\Exception; | ||
use PHPUnit\Framework\MockObject\MockObject; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Test for scope date interval functionality @see Timezone | ||
*/ | ||
class TimezoneScopeTest extends TestCase | ||
{ | ||
/** | ||
* @var string|null | ||
*/ | ||
private ?string $defaultTimeZone; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private string $scopeType = 'store'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private string $defaultTimezonePath = 'default/timezone/path'; | ||
|
||
/** | ||
* @var ScopeResolverInterface|MockObject | ||
*/ | ||
private ScopeResolverInterface|MockObject $scopeResolver; | ||
|
||
/** | ||
* @var ScopeConfigInterface|MockObject | ||
*/ | ||
private MockObject|ScopeConfigInterface $scopeConfig; | ||
|
||
/** | ||
* @var ResolverInterface|MockObject | ||
*/ | ||
private ResolverInterface|MockObject $localeResolver; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function setUp(): void | ||
{ | ||
$this->defaultTimeZone = date_default_timezone_get(); | ||
date_default_timezone_set('UTC'); | ||
$this->scopeType = 'store'; | ||
$this->defaultTimezonePath = 'default/timezone/path'; | ||
|
||
$this->scopeResolver = $this->getMockBuilder(ScopeResolverInterface::class) | ||
->getMock(); | ||
$this->localeResolver = $this->getMockBuilder(ResolverInterface::class) | ||
->getMock(); | ||
$this->scopeConfig = $this->getMockBuilder(ScopeConfigInterface::class) | ||
->getMock(); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function tearDown(): void | ||
{ | ||
date_default_timezone_set($this->defaultTimeZone); | ||
} | ||
|
||
/** | ||
* @return Timezone | ||
* @throws Exception | ||
*/ | ||
private function getTimezone(): Timezone | ||
{ | ||
return new Timezone( | ||
$this->scopeResolver, | ||
$this->localeResolver, | ||
$this->createMock(DateTime::class), | ||
$this->scopeConfig, | ||
$this->scopeType, | ||
$this->defaultTimezonePath, | ||
new DateFormatterFactory() | ||
); | ||
} | ||
|
||
/** | ||
* @return void | ||
* @throws Exception | ||
*/ | ||
public function testIsScopeDateInInterval() | ||
{ | ||
$scopeMock = $this->createMock(ScopeInterface::class); | ||
$this->scopeResolver->method('getScope')->willReturn($scopeMock); | ||
|
||
$result = $this->getTimezone()->isScopeDateInInterval( | ||
null, | ||
'2025-04-01 00:00:00', | ||
'2999-05-01 00:00:00', | ||
); | ||
|
||
$this->assertTrue($result); | ||
} | ||
|
||
/** | ||
* @return void | ||
* @throws Exception | ||
*/ | ||
public function testIsScopeDateInIntervalFalse() | ||
{ | ||
$scopeMock = $this->createMock(ScopeInterface::class); | ||
$this->scopeResolver->method('getScope')->willReturn($scopeMock); | ||
|
||
$result = $this->getTimezone()->isScopeDateInInterval( | ||
null, | ||
'2025-03-01 00:00:00', | ||
'2025-04-01 00:00:00', | ||
); | ||
|
||
$this->assertFalse($result); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We will have the same +1 day result if use '00:00:00' in the API query. I'm not sure that it's correct solution