diff options
author | Daniel Opitz <git@copynpaste.de> | 2018-10-16 22:37:48 +0200 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2018-12-04 17:10:46 +0100 |
commit | e158cc1d3b1fb33de5aaa1aaac0c7828016fb7b9 (patch) | |
tree | 4d3b4da643a428f259ca9fe1c63d97f8cecfb5fc /tests/Unit/Db | |
parent | 5c7fdb08534018ba86ec4a38f45b63cbbf67a72f (diff) |
use magic class constant instead of classname strings
Diffstat (limited to 'tests/Unit/Db')
-rw-r--r-- | tests/Unit/Db/FolderMapperTest.php | 10 | ||||
-rw-r--r-- | tests/Unit/Db/MapperTestUtility.php | 8 |
2 files changed, 8 insertions, 10 deletions
diff --git a/tests/Unit/Db/FolderMapperTest.php b/tests/Unit/Db/FolderMapperTest.php index f3ee15456..11c411b5e 100644 --- a/tests/Unit/Db/FolderMapperTest.php +++ b/tests/Unit/Db/FolderMapperTest.php @@ -16,6 +16,8 @@ namespace OCA\News\Tests\Unit\Db; use OCA\News\Db\Folder; use OCA\News\Db\FolderMapper; use OCA\News\Utility\Time; +use OCP\AppFramework\Db\DoesNotExistException; +use OCP\AppFramework\Db\MultipleObjectsReturnedException; class FolderMapperTest extends MapperTestUtility { @@ -76,9 +78,7 @@ class FolderMapperTest extends MapperTestUtility $this->setMapperResult($sql, [$id, $userId]); - $this->expectException( - '\OCP\AppFramework\Db\DoesNotExistException' - ); + $this->expectException(DoesNotExistException::class); $this->folderMapper->find($id, $userId); } @@ -94,9 +94,7 @@ class FolderMapperTest extends MapperTestUtility $this->setMapperResult($sql, [$id, $userId], $rows); - $this->expectException( - '\OCP\AppFramework\Db\MultipleObjectsReturnedException' - ); + $this->expectException(MultipleObjectsReturnedException::class); $this->folderMapper->find($id, $userId); } diff --git a/tests/Unit/Db/MapperTestUtility.php b/tests/Unit/Db/MapperTestUtility.php index 0c45a0bba..5417e16bc 100644 --- a/tests/Unit/Db/MapperTestUtility.php +++ b/tests/Unit/Db/MapperTestUtility.php @@ -23,6 +23,8 @@ namespace OCA\News\Tests\Unit\Db; +use OCP\IDBConnection; + use PHPUnit\Framework\TestCase; /** * Simple utility class for testing mappers @@ -45,13 +47,11 @@ abstract class MapperTestUtility extends TestCase { parent::setUp(); - $this->db = $this->getMockBuilder( - '\OCP\IDBConnection' - ) + $this->db = $this->getMockBuilder(IDBConnection::class) ->disableOriginalConstructor() ->getMock(); - $this->query = $this->createMock('\PDOStatement'); + $this->query = $this->createMock(\PDOStatement::class); $this->queryAt = 0; $this->prepareAt = 0; $this->iterators = []; |