From 60ab4941cc7e6ede095e9e4aee3c2bf9a5c3bff6 Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Sun, 20 Sep 2020 22:03:05 +0200 Subject: Move to nextcloud config and update phpunit Signed-off-by: Sean Molenaar --- tests/Unit/Db/FolderMapperTest.php | 2 +- tests/Unit/Db/ItemTest.php | 30 +++++++++++++++--------------- tests/Unit/Db/MapperFactoryTest.php | 8 ++++---- tests/Unit/Db/MapperTestUtility.php | 6 +++--- 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'tests/Unit/Db') 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('somEthäng'); @@ -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('my link'); $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('my link'); $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("ha"); @@ -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': -- cgit v1.2.3