88
99namespace Magento \Catalog \Model \Attribute \Backend ;
1010
11- use Magento \AsynchronousOperations \Api \Data \OperationInterfaceFactory ;
1211use Magento \Catalog \Api \Data \ProductInterfaceFactory ;
1312use Magento \Catalog \Model \Product ;
1413use Magento \Eav \Model \Config ;
1817use PHPUnit \Framework \TestCase ;
1918
2019/**
21- * Test for Special Start Date attribute
20+ * Test for Start Date attribute backend model
21+ *
22+ * @see \Magento\Catalog\Model\Attribute\Backend\Startdate
2223 *
2324 * @magentoAppArea adminhtml
24- * @magentoAppIsolation enabled
2525 */
2626class StartdateTest extends TestCase
2727{
@@ -45,7 +45,8 @@ protected function setUp(): void
4545 $ this ->productFactory = $ this ->objectManager ->get (ProductInterfaceFactory::class);
4646 $ this ->startDate = $ this ->objectManager ->get (Startdate::class);
4747 $ attribute = $ this ->objectManager ->get (Config::class)->getAttribute (Product::ENTITY , 'news_from_date ' );
48- $ attribute ->setMaxValue (date ('Y-m-d H:i:s ' , strtotime ('-10 days ' )));
48+ //$attribute->setMaxValue(date('Y-m-d H:i:s', strtotime('-10 days')));
49+ $ attribute ->setMaxValue (new \DateTime ('-10 days ' ));
4950 $ this ->startDate ->setAttribute ($ attribute );
5051 }
5152
@@ -66,7 +67,8 @@ public function testBeforeSave(): void
6667 public function testValidate (): void
6768 {
6869 $ product = $ this ->productFactory ->create ();
69- $ product ->setNewsFromDate (date ('d-m-Y ' ));
70+ //$product->setNewsFromDate(date('d-m-Y'));
71+ $ product ->setNewsFromDate (new \DateTime ());
7072 $ this ->expectException (Exception::class);
7173 $ msg = __ ('Make sure the To Date is later than or the same as the From Date. ' );
7274 $ this ->expectExceptionMessage ((string )$ msg );
0 commit comments