summaryrefslogtreecommitdiffstats
path: root/tests/Unit/Db
diff options
context:
space:
mode:
authorSean Molenaar <sean@seanmolenaar.eu>2020-09-20 22:03:05 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2020-09-25 19:18:04 +0200
commit60ab4941cc7e6ede095e9e4aee3c2bf9a5c3bff6 (patch)
treebaf0b07dd1c545efeb59437af46a99f4d9f69425 /tests/Unit/Db
parent2c8b4fa019749113658b9ed8cae211b679e4cbc0 (diff)
Move to nextcloud config and update phpunit
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'tests/Unit/Db')
-rw-r--r--tests/Unit/Db/FolderMapperTest.php2
-rw-r--r--tests/Unit/Db/ItemTest.php30
-rw-r--r--tests/Unit/Db/MapperFactoryTest.php8
-rw-r--r--tests/Unit/Db/MapperTestUtility.php6
4 files changed, 23 insertions, 23 deletions
diff --git a/tests/Unit/Db/FolderMapperTest.php b/tests/Unit/Db/FolderMapperTest.php
index 11c411b5e..f8544da65 100644
--- a/tests/Unit/Db/FolderMapperTest.php
+++ b/tests/Unit/Db/FolderMapperTest.php
@@ -28,7 +28,7 @@ class FolderMapperTest extends MapperTestUtility
/** @var string */
private $user;
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/Unit/Db/ItemTest.php b/tests/Unit/Db/ItemTest.php
index 6b63f8685..c9a353ea7 100644
--- a/tests/Unit/Db/ItemTest.php
+++ b/tests/Unit/Db/ItemTest.php
@@ -22,11 +22,11 @@ class ItemTest extends TestCase
{
/**
- * @var Item
+ * @var Item
*/
private $item;
- protected function setUp()
+ protected function setUp(): void
{
$this->item = new Item();
$this->item->setStatus(0);
@@ -65,7 +65,7 @@ class ItemTest extends TestCase
}
- public function testToAPI()
+ public function testToAPI()
{
$item = new Item();
$item->setId(3);
@@ -117,7 +117,7 @@ class ItemTest extends TestCase
}
- public function testJSONSerialize()
+ public function testJSONSerialize()
{
$item = new Item();
$item->setId(3);
@@ -167,7 +167,7 @@ class ItemTest extends TestCase
);
}
- public function testToExport()
+ public function testToExport()
{
$item = new Item();
$item->setId(3);
@@ -216,7 +216,7 @@ class ItemTest extends TestCase
}
- private function createImportItem($isRead)
+ private function createImportItem($isRead)
{
$item = new Item();
$item->setGuid('guid');
@@ -242,7 +242,7 @@ class ItemTest extends TestCase
}
- public function testSearchIndex()
+ public function testSearchIndex()
{
$item = new Item();
$item->setBody('<a>somEth&auml;ng</a>');
@@ -255,7 +255,7 @@ class ItemTest extends TestCase
}
- public function testFromImport()
+ public function testFromImport()
{
$item = $this->createImportItem(false);
@@ -282,7 +282,7 @@ class ItemTest extends TestCase
}
- public function testFromImportRead()
+ public function testFromImportRead()
{
$item = $this->createImportItem(true);
@@ -315,7 +315,7 @@ class ItemTest extends TestCase
$item = new Item();
$item->setAuthor('<a>my link</li>');
$this->assertEquals('my link', $item->getAuthor());
- $this->assertContains('author', $item->getUpdatedFields());
+ $this->assertArrayHasKey('author', $item->getUpdatedFields());
}
@@ -324,11 +324,11 @@ class ItemTest extends TestCase
$item = new Item();
$item->setTitle('<a>my link</li>');
$this->assertEquals('my link', $item->getTitle());
- $this->assertContains('title', $item->getUpdatedFields());
+ $this->assertArrayHasKey('title', $item->getUpdatedFields());
}
- public function testSetXSSUrl()
+ public function testSetXSSUrl()
{
$item = new Item();
$item->setUrl('javascript:alert()');
@@ -336,7 +336,7 @@ class ItemTest extends TestCase
}
- public function testSetMagnetUrl()
+ public function testSetMagnetUrl()
{
$item = new Item();
$item->setUrl('magnet://link.com');
@@ -344,7 +344,7 @@ class ItemTest extends TestCase
}
- public function testMakeLinksInBodyOpenNewTab()
+ public function testMakeLinksInBodyOpenNewTab()
{
$item = new Item();
$item->setBody("<a href=\"test\">ha</a>");
@@ -354,7 +354,7 @@ class ItemTest extends TestCase
);
}
- public function testComputeFingerPrint()
+ public function testComputeFingerPrint()
{
$title = 'a';
$body = 'b';
diff --git a/tests/Unit/Db/MapperFactoryTest.php b/tests/Unit/Db/MapperFactoryTest.php
index 697a62bee..97680e20b 100644
--- a/tests/Unit/Db/MapperFactoryTest.php
+++ b/tests/Unit/Db/MapperFactoryTest.php
@@ -29,26 +29,26 @@ class MapperFactoryTest extends TestCase
private $db;
private $settings;
- public function setUp()
+ public function setUp(): void
{
$this->db = $this->getMockBuilder(IDBConnection::class)
->disableOriginalConstructor()
->getMock();
}
- public function testGetItemMapperSqlite()
+ public function testGetItemMapperSqlite()
{
$factory = new MapperFactory($this->db, 'sqlite', new Time());
$this->assertTrue($factory->build() instanceof ItemMapper);
}
- public function testGetItemMapperPostgres()
+ public function testGetItemMapperPostgres()
{
$factory = new MapperFactory($this->db, 'pgsql', new Time());
$this->assertTrue($factory->build() instanceof ItemMapper);
}
- public function testGetItemMapperMysql()
+ public function testGetItemMapperMysql()
{
$factory = new MapperFactory($this->db, 'mysql', new Time());
$this->assertTrue($factory->build() instanceof MysqlMapper);
diff --git a/tests/Unit/Db/MapperTestUtility.php b/tests/Unit/Db/MapperTestUtility.php
index 5417e16bc..b414b43e3 100644
--- a/tests/Unit/Db/MapperTestUtility.php
+++ b/tests/Unit/Db/MapperTestUtility.php
@@ -43,7 +43,7 @@ abstract class MapperTestUtility extends TestCase
* Run this function before the actual test to either set or initialize the
* db. After this the db can be accessed by using $this->db
*/
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
@@ -64,7 +64,7 @@ abstract class MapperTestUtility extends TestCase
* @param array $array
* @return bool true if associative
*/
- private function isAssocArray(array $array)
+ private function isAssocArray(array $array)
{
return array_values($array) !== $array;
}
@@ -75,7 +75,7 @@ abstract class MapperTestUtility extends TestCase
* @param $value
* @return PDO constant
*/
- private function getPDOType($value)
+ private function getPDOType($value)
{
switch (gettype($value)) {
case 'integer':