From 43e498844e8c1aa519a19238d2cf3d6b95e1aab0 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 24 Oct 2017 15:26:53 +0200 Subject: Use ::class in test mocks Signed-off-by: Morris Jobke --- .../unit/Connector/Sabre/SharesPluginTest.php | 32 ++++++++++++++-------- 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php') diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php index 2b4a886050a..7c735ca2334 100644 --- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php @@ -23,6 +23,14 @@ */ namespace OCA\DAV\Tests\unit\Connector\Sabre; +use OCA\DAV\Connector\Sabre\Directory; +use OCA\DAV\Connector\Sabre\File; +use OCP\Files\Folder; +use OCP\IUser; +use OCP\IUserSession; +use OCP\Share\IManager; +use Sabre\DAV\Tree; + class SharesPluginTest extends \Test\TestCase { const SHARETYPES_PROPERTYNAME = \OCA\DAV\Connector\Sabre\SharesPlugin::SHARETYPES_PROPERTYNAME; @@ -55,26 +63,26 @@ class SharesPluginTest extends \Test\TestCase { public function setUp() { parent::setUp(); $this->server = new \Sabre\DAV\Server(); - $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree') + $this->tree = $this->getMockBuilder(Tree::class) ->disableOriginalConstructor() ->getMock(); - $this->shareManager = $this->getMockBuilder('\OCP\Share\IManager') + $this->shareManager = $this->getMockBuilder(IManager::class) ->disableOriginalConstructor() ->getMock(); - $user = $this->getMockBuilder('\OCP\IUser') + $user = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); $user->expects($this->once()) ->method('getUID') ->will($this->returnValue('user1')); - $userSession = $this->getMockBuilder('\OCP\IUserSession') + $userSession = $this->getMockBuilder(IUserSession::class) ->disableOriginalConstructor() ->getMock(); $userSession->expects($this->once()) ->method('getUser') ->will($this->returnValue($user)); - $this->userFolder = $this->getMockBuilder('\OCP\Files\Folder') + $this->userFolder = $this->getMockBuilder(Folder::class) ->disableOriginalConstructor() ->getMock(); @@ -102,7 +110,7 @@ class SharesPluginTest extends \Test\TestCase { ->will($this->returnValue('/subdir')); // node API nodes - $node = $this->getMockBuilder('\OCP\Files\Folder') + $node = $this->getMockBuilder(Folder::class) ->disableOriginalConstructor() ->getMock(); @@ -149,7 +157,7 @@ class SharesPluginTest extends \Test\TestCase { * @dataProvider sharesGetPropertiesDataProvider */ public function testPreloadThenGetProperties($shareTypes) { - $sabreNode1 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File') + $sabreNode1 = $this->getMockBuilder(File::class) ->disableOriginalConstructor() ->getMock(); $sabreNode1->expects($this->any()) @@ -157,7 +165,7 @@ class SharesPluginTest extends \Test\TestCase { ->will($this->returnValue(111)); $sabreNode1->expects($this->any()) ->method('getPath'); - $sabreNode2 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File') + $sabreNode2 = $this->getMockBuilder(File::class) ->disableOriginalConstructor() ->getMock(); $sabreNode2->expects($this->any()) @@ -167,7 +175,7 @@ class SharesPluginTest extends \Test\TestCase { ->method('getPath') ->will($this->returnValue('/subdir/foo')); - $sabreNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory') + $sabreNode = $this->getMockBuilder(Directory::class) ->disableOriginalConstructor() ->getMock(); $sabreNode->expects($this->any()) @@ -181,19 +189,19 @@ class SharesPluginTest extends \Test\TestCase { ->will($this->returnValue('/subdir')); // node API nodes - $node = $this->getMockBuilder('\OCP\Files\Folder') + $node = $this->getMockBuilder(Folder::class) ->disableOriginalConstructor() ->getMock(); $node->expects($this->any()) ->method('getId') ->will($this->returnValue(123)); - $node1 = $this->getMockBuilder('\OCP\Files\File') + $node1 = $this->getMockBuilder(File::class) ->disableOriginalConstructor() ->getMock(); $node1->expects($this->any()) ->method('getId') ->will($this->returnValue(111)); - $node2 = $this->getMockBuilder('\OCP\Files\File') + $node2 = $this->getMockBuilder(File::class) ->disableOriginalConstructor() ->getMock(); $node2->expects($this->any()) -- cgit v1.2.3