@@ -79,6 +79,55 @@ public function test_saveTaxRateAction_withNameAndTaxRateShouldBe_true()
7979        static ::assertSame ('33 % ' , $ savedTaxResult ['description ' ]);
8080    }
8181
82+     public  function  test_checkCronDate_shouldReturnEmptyDate ()
83+     {
84+         $ controller  = $ this  ->getController ();
85+         $ emptyDate  = '0000-00-00 00:00:00 ' ;
86+ 
87+         $ reflectionMethod  = (new  \ReflectionClass (\Shopware_Controllers_Backend_SwagTax::class))->getMethod ('checkCronDate ' );
88+         $ reflectionMethod ->setAccessible (true );
89+ 
90+         $ result  = $ reflectionMethod ->invoke ($ controller , null );
91+         static ::assertSame ($ emptyDate , $ result );
92+ 
93+         $ result  = $ reflectionMethod ->invoke ($ controller , '' );
94+         static ::assertSame ($ emptyDate , $ result );
95+ 
96+         $ result  = $ reflectionMethod ->invoke ($ controller , '0 ' );
97+         static ::assertSame ($ emptyDate , $ result );
98+ 
99+         $ result  = $ reflectionMethod ->invoke ($ controller , '0000-00-00 00:00:00 ' );
100+         static ::assertSame ($ emptyDate , $ result );
101+ 
102+         $ result  = $ reflectionMethod ->invoke ($ controller , '2020-01-01 00:00:00 ' );
103+         static ::assertSame ($ emptyDate , $ result );
104+ 
105+         $ result  = $ reflectionMethod ->invoke ($ controller , '2020-01-01 00:00:00 ' );
106+         static ::assertSame ($ emptyDate , $ result );
107+ 
108+         $ now  = date ('Y-m-d H:i:s ' );
109+         $ past  = date ('Y-m-d H:i:s ' , strtotime ('-1 hour ' , strtotime ($ now )));
110+         $ result  = $ reflectionMethod ->invoke ($ controller , $ past );
111+         static ::assertSame ($ emptyDate , $ result );
112+     }
113+ 
114+     public  function  test_checkCronDate_shouldReturnGivenDate ()
115+     {
116+         $ controller  = $ this  ->getController ();
117+ 
118+         $ reflectionMethod  = (new  \ReflectionClass (\Shopware_Controllers_Backend_SwagTax::class))->getMethod ('checkCronDate ' );
119+         $ reflectionMethod ->setAccessible (true );
120+ 
121+         $ future  = '2222-02-02 20:20:20 ' ;
122+         $ result  = $ reflectionMethod ->invoke ($ controller , $ future );
123+         static ::assertSame ($ future , $ result );
124+ 
125+         $ now  = date ('Y-m-d H:i:s ' );
126+         $ future  = date ('Y-m-d H:i:s ' , strtotime ('+1 hour ' , strtotime ($ now )));
127+         $ result  = $ reflectionMethod ->invoke ($ controller , $ future );
128+         static ::assertSame ($ future , $ result );
129+     }
130+ 
82131    private  function  getController ()
83132    {
84133        $ controller  = new  \Shopware_Controllers_Backend_SwagTax ();
0 commit comments