summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2016-07-23 18:34:17 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2016-07-23 18:34:17 +0200
commit9b1fe46fe995bc103d3c5cfa9a552d050ff0ead8 (patch)
tree7b86abb65272df89f61e849a08edef5326207b8a /tests
parentb88d42074dcd0842d0db3ca8ed24b0b9ccb78a7a (diff)
Add timestamps for all entities in milisecond unix time format
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/db/FeedMapperTest.php4
-rw-r--r--tests/unit/db/FolderMapperTest.php4
-rw-r--r--tests/unit/db/ItemMapperTest.php4
-rw-r--r--tests/unit/db/MapperFactoryTest.php7
-rw-r--r--tests/unit/db/mysql/ItemMapperTest.php4
-rw-r--r--tests/unit/fetcher/FeedFetcherTest.php3
-rw-r--r--tests/unit/service/FeedServiceTest.php4
-rw-r--r--tests/unit/service/FolderServiceTest.php2
-rw-r--r--tests/unit/service/ItemServiceTest.php7
9 files changed, 22 insertions, 17 deletions
diff --git a/tests/unit/db/FeedMapperTest.php b/tests/unit/db/FeedMapperTest.php
index 97488fb88..7e2f8d777 100644
--- a/tests/unit/db/FeedMapperTest.php
+++ b/tests/unit/db/FeedMapperTest.php
@@ -14,6 +14,8 @@
namespace OCA\News\Db;
+use OCA\News\Utility\Time;
+
class FeedMapperTest extends \OCA\News\Tests\Unit\Db\MapperTestUtility {
private $mapper;
@@ -22,7 +24,7 @@ class FeedMapperTest extends \OCA\News\Tests\Unit\Db\MapperTestUtility {
protected function setUp(){
parent::setUp();
- $this->mapper = new FeedMapper($this->db);
+ $this->mapper = new FeedMapper($this->db, new Time());
// create mock feeds
$feed1 = new Feed();
diff --git a/tests/unit/db/FolderMapperTest.php b/tests/unit/db/FolderMapperTest.php
index 00ad2127d..fcb82e7e1 100644
--- a/tests/unit/db/FolderMapperTest.php
+++ b/tests/unit/db/FolderMapperTest.php
@@ -14,6 +14,8 @@
namespace OCA\News\Db;
+use OCA\News\Utility\Time;
+
class FolderMapperTest extends \OCA\News\Tests\Unit\Db\MapperTestUtility {
private $folderMapper;
@@ -23,7 +25,7 @@ class FolderMapperTest extends \OCA\News\Tests\Unit\Db\MapperTestUtility {
protected function setUp(){
parent::setUp();
- $this->folderMapper = new FolderMapper($this->db);
+ $this->folderMapper = new FolderMapper($this->db, new Time());
// create mock folders
$folder1 = new Folder();
diff --git a/tests/unit/db/ItemMapperTest.php b/tests/unit/db/ItemMapperTest.php
index 8b42aebb8..7b11b7862 100644
--- a/tests/unit/db/ItemMapperTest.php
+++ b/tests/unit/db/ItemMapperTest.php
@@ -14,6 +14,8 @@
namespace OCA\News\Db;
+use OCA\News\Utility\Time;
+
class ItemMapperTest extends \OCA\News\Tests\Unit\Db\MapperTestUtility {
private $mapper;
@@ -29,7 +31,7 @@ class ItemMapperTest extends \OCA\News\Tests\Unit\Db\MapperTestUtility {
public function setUp() {
parent::setup();
- $this->mapper = new ItemMapper($this->db);
+ $this->mapper = new ItemMapper($this->db, new Time());
// create mock items
$item1 = new Item();
diff --git a/tests/unit/db/MapperFactoryTest.php b/tests/unit/db/MapperFactoryTest.php
index 341dea0e9..1544ddf2c 100644
--- a/tests/unit/db/MapperFactoryTest.php
+++ b/tests/unit/db/MapperFactoryTest.php
@@ -13,6 +13,7 @@
namespace OCA\News\Db;
+use OCA\News\Utility\Time;
use PHPUnit_Framework_TestCase;
use OCP\IDb;
@@ -32,17 +33,17 @@ class MapperFactoryTest extends PHPUnit_Framework_TestCase {
}
public function testGetItemMapperSqlite() {
- $factory = new MapperFactory($this->db, 'sqlite');
+ $factory = new MapperFactory($this->db, 'sqlite', new Time());
$this->assertTrue($factory->build() instanceof ItemMapper);
}
public function testGetItemMapperPostgres() {
- $factory = new MapperFactory($this->db, 'pgsql');
+ $factory = new MapperFactory($this->db, 'pgsql', new Time());
$this->assertTrue($factory->build() instanceof ItemMapper);
}
public function testGetItemMapperMysql() {
- $factory = new MapperFactory($this->db, 'mysql');
+ $factory = new MapperFactory($this->db, 'mysql', new Time());
$this->assertTrue($factory->build() instanceof MysqlMapper);
}
diff --git a/tests/unit/db/mysql/ItemMapperTest.php b/tests/unit/db/mysql/ItemMapperTest.php
index 3c091341a..57f3cd77f 100644
--- a/tests/unit/db/mysql/ItemMapperTest.php
+++ b/tests/unit/db/mysql/ItemMapperTest.php
@@ -15,7 +15,7 @@ namespace OCA\News\Db\Mysql;
use \OCA\News\Db\Item;
use \OCA\News\Db\StatusFlag;
-
+use OCA\News\Utility\Time;
class ItemMapperTest extends \OCA\News\Tests\Unit\Db\MapperTestUtility {
@@ -32,7 +32,7 @@ class ItemMapperTest extends \OCA\News\Tests\Unit\Db\MapperTestUtility {
public function setUp() {
parent::setUp();
- $this->mapper = new ItemMapper($this->db);
+ $this->mapper = new ItemMapper($this->db, new Time());
// create mock items
$item1 = new Item();
diff --git a/tests/unit/fetcher/FeedFetcherTest.php b/tests/unit/fetcher/FeedFetcherTest.php
index 33383910e..4b91e15c3 100644
--- a/tests/unit/fetcher/FeedFetcherTest.php
+++ b/tests/unit/fetcher/FeedFetcherTest.php
@@ -90,7 +90,7 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase {
$this->time = 2323;
$timeFactory = $this->getMockBuilder(
- '\OCP\AppFramework\Utility\ITimeFactory')
+ '\OCA\News\Utility\Time')
->disableOriginalConstructor()
->getMock();
$timeFactory->expects($this->any())
@@ -221,7 +221,6 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase {
$item->setGuid($this->guid);
$item->setGuidHash($this->guid);
$item->setBody($this->body);
- $item->setLastModified($this->time);
$item->setRtl(false);
$this->expectItem('getAuthor', $this->author);
diff --git a/tests/unit/service/FeedServiceTest.php b/tests/unit/service/FeedServiceTest.php
index efd7e5f33..ef16b9e78 100644
--- a/tests/unit/service/FeedServiceTest.php
+++ b/tests/unit/service/FeedServiceTest.php
@@ -47,7 +47,7 @@ class FeedServiceTest extends \PHPUnit_Framework_TestCase {
$this->loggerParams = ['hi'];
$this->time = 222;
$this->autoPurgeMinimumInterval = 10;
- $timeFactory = $this->getMockBuilder('\OCP\AppFramework\Utility\ITimeFactory')
+ $timeFactory = $this->getMockBuilder('\OCA\News\Utility\Time')
->disableOriginalConstructor()
->getMock();
$timeFactory->expects($this->any())
@@ -760,7 +760,6 @@ class FeedServiceTest extends \PHPUnit_Framework_TestCase {
$item->setEnclosureLink('lin');
$item->setUnread();
$item->setUnstarred();
- $item->setLastModified($this->time);
$item->generateSearchIndex();
$json = $item->toExport(['feed3' => $feed]);
@@ -817,7 +816,6 @@ class FeedServiceTest extends \PHPUnit_Framework_TestCase {
$item->setEnclosureLink('lin');
$item->setUnread();
$item->setUnstarred();
- $item->setLastModified($this->time);
$item->generateSearchIndex();
$json = $item->toExport(['feed3' => $feed]);
diff --git a/tests/unit/service/FolderServiceTest.php b/tests/unit/service/FolderServiceTest.php
index 275bc8992..319a896d6 100644
--- a/tests/unit/service/FolderServiceTest.php
+++ b/tests/unit/service/FolderServiceTest.php
@@ -30,7 +30,7 @@ class FolderServiceTest extends \PHPUnit_Framework_TestCase {
->disableOriginalConstructor()
->getMock();
$this->time = 222;
- $timeFactory = $this->getMockBuilder('\OCP\AppFramework\Utility\ITimeFactory')
+ $timeFactory = $this->getMockBuilder('\OCA\News\Utility\Time')
->disableOriginalConstructor()
->getMock();
$timeFactory->expects($this->any())
diff --git a/tests/unit/service/ItemServiceTest.php b/tests/unit/service/ItemServiceTest.php
index e9bf47490..e562757f4 100644
--- a/tests/unit/service/ItemServiceTest.php
+++ b/tests/unit/service/ItemServiceTest.php
@@ -34,12 +34,15 @@ class ItemServiceTest extends \PHPUnit_Framework_TestCase {
protected function setUp(){
$this->time = 222;
- $this->timeFactory = $this->getMockBuilder('\OCP\AppFramework\Utility\ITimeFactory')
+ $this->timeFactory = $this->getMockBuilder('\OCA\News\Utility\Time')
->disableOriginalConstructor()
->getMock();
$this->timeFactory->expects($this->any())
->method('getTime')
->will($this->returnValue($this->time));
+ $this->timeFactory->expects($this->any())
+ ->method('getMicroTime')
+ ->will($this->returnValue($this->time));
$this->mapper = $this->getMockBuilder('\OCA\News\Db\ItemMapper')
->disableOriginalConstructor()
->getMock();
@@ -219,7 +222,6 @@ class ItemServiceTest extends \PHPUnit_Framework_TestCase {
$expectedItem->setStatus(128);
$expectedItem->setStarred();
$expectedItem->setId($itemId);
- $expectedItem->setLastModified($this->time);
$this->mapper->expects($this->once())
->method('findByGuidHash')
@@ -253,7 +255,6 @@ class ItemServiceTest extends \PHPUnit_Framework_TestCase {
$expectedItem->setStatus(128);
$expectedItem->setUnstarred();
$expectedItem->setId($itemId);
- $expectedItem->setLastModified($this->time);
$this->mapper->expects($this->once())
->method('findByGuidHash')