8
8
9
9
namespace Magento \Catalog \Model \Attribute \Backend ;
10
10
11
- use Magento \AsynchronousOperations \Api \Data \OperationInterfaceFactory ;
12
11
use Magento \Catalog \Api \Data \ProductInterfaceFactory ;
13
12
use Magento \Catalog \Model \Product ;
14
13
use Magento \Eav \Model \Config ;
18
17
use PHPUnit \Framework \TestCase ;
19
18
20
19
/**
21
- * Test for Special Start Date attribute
20
+ * Test for Start Date attribute backend model
21
+ *
22
+ * @see \Magento\Catalog\Model\Attribute\Backend\Startdate
22
23
*
23
24
* @magentoAppArea adminhtml
24
- * @magentoAppIsolation enabled
25
25
*/
26
26
class StartdateTest extends TestCase
27
27
{
@@ -45,7 +45,8 @@ protected function setUp(): void
45
45
$ this ->productFactory = $ this ->objectManager ->get (ProductInterfaceFactory::class);
46
46
$ this ->startDate = $ this ->objectManager ->get (Startdate::class);
47
47
$ 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 ' ));
49
50
$ this ->startDate ->setAttribute ($ attribute );
50
51
}
51
52
@@ -66,7 +67,8 @@ public function testBeforeSave(): void
66
67
public function testValidate (): void
67
68
{
68
69
$ product = $ this ->productFactory ->create ();
69
- $ product ->setNewsFromDate (date ('d-m-Y ' ));
70
+ //$product->setNewsFromDate(date('d-m-Y'));
71
+ $ product ->setNewsFromDate (new \DateTime ());
70
72
$ this ->expectException (Exception::class);
71
73
$ msg = __ ('Make sure the To Date is later than or the same as the From Date. ' );
72
74
$ this ->expectExceptionMessage ((string )$ msg );
0 commit comments