summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Brahmer <info@b-brahmer.de>2022-03-31 18:48:18 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2022-04-30 12:24:01 +0200
commit98c3aece10f7e687592b8b683c7b98736304d2fb (patch)
tree48957030af08fa3c8536e348952ce98f333a37eb
parent3bc38d1ce7b763ff141c53a1ca30d3d870fc644b (diff)
Partly fix test
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
-rw-r--r--lib/Db/FeedMapperV2.php8
-rw-r--r--lib/Db/FolderMapperV2.php7
-rw-r--r--tests/Unit/Db/FeedMapperTest.php12
-rw-r--r--tests/Unit/Db/FolderMapperTest.php12
4 files changed, 20 insertions, 19 deletions
diff --git a/lib/Db/FeedMapperV2.php b/lib/Db/FeedMapperV2.php
index 3a6494e06..c80bf118b 100644
--- a/lib/Db/FeedMapperV2.php
+++ b/lib/Db/FeedMapperV2.php
@@ -186,16 +186,16 @@ class FeedMapperV2 extends NewsMapperV2
},
$this->db->executeQuery($idBuilder->getSQL(), $idBuilder->getParameters())->fetchAll()
);
-
- $builder = $this->db->getQueryBuilder();
$time = new Time();
+ $builder = $this->db->getQueryBuilder();
$builder->update(ItemMapperV2::TABLE_NAME)
->set('unread', $builder->createParameter('unread'))
- ->set('last_modified', $time->getMicroTime())
+ ->set('last_modified', $builder->createParameter('last_modified'))
->andWhere('id IN (:idList)')
->andWhere('unread != :unread')
->setParameter('unread', false, IQueryBuilder::PARAM_BOOL)
- ->setParameter('idList', $idList, IQueryBuilder::PARAM_INT_ARRAY);
+ ->setParameter('idList', $idList, IQueryBuilder::PARAM_INT_ARRAY)
+ ->setParameter('last_modified', $time->getMicroTime(), IQueryBuilder::PARAM_STR);
return $this->db->executeStatement(
$builder->getSQL(),
diff --git a/lib/Db/FolderMapperV2.php b/lib/Db/FolderMapperV2.php
index 0944c7ab6..9afda11c4 100644
--- a/lib/Db/FolderMapperV2.php
+++ b/lib/Db/FolderMapperV2.php
@@ -128,15 +128,16 @@ class FolderMapperV2 extends NewsMapperV2
return intval($value['id']);
}, $this->db->executeQuery($idBuilder->getSQL(), $idBuilder->getParameters())->fetchAll());
- $builder = $this->db->getQueryBuilder();
$time = new Time();
+ $builder = $this->db->getQueryBuilder();
$builder->update(ItemMapperV2::TABLE_NAME)
->set('unread', $builder->createParameter('unread'))
- ->set('last_modified', $time->getMicroTime())
+ ->set('last_modified', $builder->createParameter('last_modified'))
->andWhere('id IN (:idList)')
->andWhere('unread != :unread')
->setParameter('unread', false, IQueryBuilder::PARAM_BOOL)
- ->setParameter('idList', $idList, IQueryBuilder::PARAM_INT_ARRAY);
+ ->setParameter('idList', $idList, IQueryBuilder::PARAM_INT_ARRAY)
+ ->setParameter('last_modified', $time->getMicroTime(), IQueryBuilder::PARAM_STR);
return $this->db->executeStatement(
$builder->getSQL(),
diff --git a/tests/Unit/Db/FeedMapperTest.php b/tests/Unit/Db/FeedMapperTest.php
index 499989062..51c2adcec 100644
--- a/tests/Unit/Db/FeedMapperTest.php
+++ b/tests/Unit/Db/FeedMapperTest.php
@@ -519,13 +519,13 @@ class FeedMapperTest extends MapperTestUtility
->with('news_items')
->will($this->returnSelf());
- $this->builder->expects($this->once())
+ $this->builder->expects($this->exactly(2))
->method('createParameter')
->will($this->returnArgument(0));
- $this->builder->expects($this->once())
+ $this->builder->expects($this->exactly(2))
->method('set')
- ->with('unread', 'unread')
+ ->withConsecutive(['unread', 'unread'], ['last_modified', 'last_modified'])
->will($this->returnSelf());
$this->builder->expects($this->exactly(2))
@@ -616,7 +616,7 @@ class FeedMapperTest extends MapperTestUtility
->with('SQL QUERY')
->willReturn($result);
- $this->builder->expects($this->once())
+ $this->builder->expects($this->exactly(2))
->method('createParameter')
->will($this->returnArgument(0));
@@ -625,9 +625,9 @@ class FeedMapperTest extends MapperTestUtility
->with('news_items')
->will($this->returnSelf());
- $this->builder->expects($this->once())
+ $this->builder->expects($this->exactly(2))
->method('set')
- ->with('unread', 'unread')
+ ->withConsecutive(['unread', 'unread'], ['last_modified', 'last_modified'])
->will($this->returnSelf());
$this->builder->expects($this->exactly(2))
diff --git a/tests/Unit/Db/FolderMapperTest.php b/tests/Unit/Db/FolderMapperTest.php
index a7f9f0c9d..1d621b501 100644
--- a/tests/Unit/Db/FolderMapperTest.php
+++ b/tests/Unit/Db/FolderMapperTest.php
@@ -342,7 +342,7 @@ class FolderMapperTest extends MapperTestUtility
->with('SQL QUERY')
->willReturn($result);
- $this->builder->expects($this->once())
+ $this->builder->expects($this->exactly(2))
->method('createParameter')
->will($this->returnArgument(0));
@@ -351,9 +351,9 @@ class FolderMapperTest extends MapperTestUtility
->with('news_items')
->will($this->returnSelf());
- $this->builder->expects($this->once())
+ $this->builder->expects($this->exactly(2))
->method('set')
- ->with('unread', 'unread')
+ ->withConsecutive(['unread', 'unread'], ['last_modified', 'last_modified'])
->will($this->returnSelf());
$this->builder->expects($this->exactly(2))
@@ -445,7 +445,7 @@ class FolderMapperTest extends MapperTestUtility
->with('SQL QUERY')
->willReturn($result);
- $this->builder->expects($this->once())
+ $this->builder->expects($this->exactly(2))
->method('createParameter')
->will($this->returnArgument(0));
@@ -454,9 +454,9 @@ class FolderMapperTest extends MapperTestUtility
->with('news_items')
->will($this->returnSelf());
- $this->builder->expects($this->once())
+ $this->builder->expects($this->exactly(2))
->method('set')
- ->with('unread', 'unread')
+ ->withConsecutive(['unread', 'unread'], ['last_modified', 'last_modified'])
->will($this->returnSelf());
$this->builder->expects($this->exactly(2))