Browse Source

[tests] make sure timestampable will not fail when testing in second difference

gedi 13 năm trước cách đây
mục cha
commit
8028d4d888

+ 2 - 2
tests/Gedmo/Timestampable/NoInterfaceTest.php

@@ -45,8 +45,8 @@ class NoInterfaceTest extends BaseTestCaseORM
             $test->getCreated()->format('Y-m-d H:i:s')
             $test->getCreated()->format('Y-m-d H:i:s')
         );
         );
         $this->assertEquals(
         $this->assertEquals(
-            $date->format('Y-m-d H:i:s'),
-            $test->getUpdated()->format('Y-m-d H:i:s')
+            $date->format('Y-m-d H:i'),
+            $test->getUpdated()->format('Y-m-d H:i')
         );
         );
     }
     }
 
 

+ 4 - 4
tests/Gedmo/Timestampable/TimestampableDocumentTest.php

@@ -38,8 +38,8 @@ class TimestampableDocumentTest extends BaseTestCaseMongoODM
         $date = new \DateTime();
         $date = new \DateTime();
         $this->assertEquals(time(), (string)$article->getCreated());
         $this->assertEquals(time(), (string)$article->getCreated());
         $this->assertEquals(
         $this->assertEquals(
-            $date->format('Y-m-d H:i:s'),
-            $article->getUpdated()->format('Y-m-d H:i:s')
+            $date->format('Y-m-d H:i'),
+            $article->getUpdated()->format('Y-m-d H:i')
         );
         );
 
 
         $published = new Type;
         $published = new Type;
@@ -55,8 +55,8 @@ class TimestampableDocumentTest extends BaseTestCaseMongoODM
         $article = $repo->findOneByTitle('Timestampable Article');
         $article = $repo->findOneByTitle('Timestampable Article');
         $date = new \DateTime();
         $date = new \DateTime();
         $this->assertEquals(
         $this->assertEquals(
-            $date->format('Y-m-d H:i:s'),
-            $article->getPublished()->format('Y-m-d H:i:s')
+            $date->format('Y-m-d H:i'),
+            $article->getPublished()->format('Y-m-d H:i')
         );
         );
     }
     }
 
 

+ 8 - 13
tests/Gedmo/Timestampable/TimestampableTest.php

@@ -59,15 +59,15 @@ class TimestampableTest extends BaseTestCaseORM
             $sport->getCreated()->format('Y-m-d H:i:s')
             $sport->getCreated()->format('Y-m-d H:i:s')
         );
         );
         $this->assertEquals(
         $this->assertEquals(
-            $date->format('Y-m-d H:i:s'),
-            $sport->getUpdated()->format('Y-m-d H:i:s')
+            $date->format('Y-m-d H:i'),
+            $sport->getUpdated()->format('Y-m-d H:i')
         );
         );
         $this->assertEquals(null, $sport->getPublished());
         $this->assertEquals(null, $sport->getPublished());
 
 
         $sportComment = $this->em->getRepository(self::COMMENT)->findOneByMessage('hello');
         $sportComment = $this->em->getRepository(self::COMMENT)->findOneByMessage('hello');
         $this->assertEquals(
         $this->assertEquals(
-            $date->format('H:i:s'),
-            $sportComment->getModified()->format('H:i:s')
+            $date->format('H:i'),
+            $sportComment->getModified()->format('H:i')
         );
         );
         $this->assertEquals(null, $sportComment->getClosed());
         $this->assertEquals(null, $sportComment->getClosed());
 
 
@@ -86,18 +86,13 @@ class TimestampableTest extends BaseTestCaseORM
 
 
         $sportComment = $this->em->getRepository(self::COMMENT)->findOneByMessage('hello');
         $sportComment = $this->em->getRepository(self::COMMENT)->findOneByMessage('hello');
         $this->assertEquals(
         $this->assertEquals(
-            $date->format('Y-m-d H:i:s'),
-            $sportComment->getClosed()->format('Y-m-d H:i:s')
+            $date->format('Y-m-d H:i'),
+            $sportComment->getClosed()->format('Y-m-d H:i')
         );
         );
 
 
-        $sport = $this->em->getRepository(self::ARTICLE)->findOneByTitle('Updated');
         $this->assertEquals(
         $this->assertEquals(
-            $date->format('Y-m-d H:i:s'),
-            $sport->getUpdated()->format('Y-m-d H:i:s')
-        );
-        $this->assertEquals(
-            $date->format('Y-m-d H:i:s'),
-            $sport->getPublished()->format('Y-m-d H:i:s')
+            $date->format('Y-m-d H:i'),
+            $sport->getPublished()->format('Y-m-d H:i')
         );
         );
     }
     }