Skip to content

Commit 1c48c8a

Browse files
committed
MC-42215: Some item cannot be saved - Make sure the To Date is later than or the same as the From Date
- added test
1 parent 514a97d commit 1c48c8a

File tree

1 file changed

+18
-0
lines changed
  • dev/tests/integration/testsuite/Magento/Catalog/Model/Attribute/Backend

1 file changed

+18
-0
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Model/Attribute/Backend/StartdateTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public function testBeforeSave(): void
6161
}
6262

6363
/**
64+
* Test that Product with attribute "Set Product as New"
65+
* with starting date and with expired ending date throws Exception.
66+
*
6467
* @return void
6568
*/
6669
public function testValidate(): void
@@ -72,4 +75,19 @@ public function testValidate(): void
7275
$this->expectExceptionMessage((string)$msg);
7376
$this->startDate->validate($product);
7477
}
78+
79+
/**
80+
* Test that Product with attribute "Set Product as New"
81+
* without starting date and with expired ending date doesn't throw Exception.
82+
*
83+
* @return void
84+
*/
85+
public function testValidatePastEndWithNoStart(): void
86+
{
87+
$product = $this->productFactory->create();
88+
$actualResult = $this->startDate->validate($product);
89+
$this->assertEquals(true, $actualResult);
90+
$noException = $this->getExpectedExceptionMessage();
91+
$this->assertNull($noException);
92+
}
7593
}

0 commit comments

Comments
 (0)