summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2023-05-03 10:26:28 +0200
committerGitHub <noreply@github.com>2023-05-03 10:26:28 +0200
commitef87dfc478c53c293cb09756201f2ea9dd2b67b1 (patch)
tree3cbda586a273ede9de33dd5fd5274b8fde168651 /tests
parent8873960bcfd9df8433faa5754b65ae3f2e55c1c7 (diff)
parent5ed6722dd2f7570f10733cc9043d39f6bc20c6c8 (diff)
downloadnextcloud-server-ef87dfc478c53c293cb09756201f2ea9dd2b67b1.tar.gz
nextcloud-server-ef87dfc478c53c293cb09756201f2ea9dd2b67b1.zip
Merge pull request #33106 from nextcloud/feature/update-expire-date
Update expire_date column of table comments
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Comments/ManagerTest.php30
1 files changed, 28 insertions, 2 deletions
diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php
index bc1692a5958..5fa1beee374 100644
--- a/tests/lib/Comments/ManagerTest.php
+++ b/tests/lib/Comments/ManagerTest.php
@@ -516,15 +516,41 @@ class ManagerTest extends TestCase {
->setActor('users', 'alice')
->setObject('files', 'file64')
->setMessage('very beautiful, I am impressed!')
- ->setVerb('comment');
+ ->setVerb('comment')
+ ->setExpireDate(new \DateTime('+2 hours'));
$manager->save($comment);
- $comment->setMessage('very beautiful, I am really so much impressed!');
+ $loadedComment = $manager->get($comment->getId());
+ // Compare current object with database values
+ $this->assertSame($comment->getMessage(), $loadedComment->getMessage());
+ $this->assertSame(
+ $comment->getExpireDate()->format('Y-m-d H:i:s'),
+ $loadedComment->getExpireDate()->format('Y-m-d H:i:s')
+ );
+
+ // Preserve the original comment to compare after update
+ $original = clone $comment;
+
+ // Update values
+ $comment->setMessage('very beautiful, I am really so much impressed!')
+ ->setExpireDate(new \DateTime('+1 hours'));
$manager->save($comment);
$loadedComment = $manager->get($comment->getId());
+ // Compare current object with database values
$this->assertSame($comment->getMessage(), $loadedComment->getMessage());
+ $this->assertSame(
+ $comment->getExpireDate()->format('Y-m-d H:i:s'),
+ $loadedComment->getExpireDate()->format('Y-m-d H:i:s')
+ );
+
+ // Compare original object with database values
+ $this->assertNotSame($original->getMessage(), $loadedComment->getMessage());
+ $this->assertNotSame(
+ $original->getExpireDate()->format('Y-m-d H:i:s'),
+ $loadedComment->getExpireDate()->format('Y-m-d H:i:s')
+ );
}