aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Comments/CommentsPluginTest.php
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-25 22:21:27 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-25 22:21:27 +0100
commit2ee65f177e4f7e09ad2287f14d564e7068d322fb (patch)
tree39075e87ea7927e20e8956824cb7c49bf626b178 /apps/dav/tests/unit/Comments/CommentsPluginTest.php
parent3cf321fdfc4235a87015a9af2f59c63220016c65 (diff)
downloadnextcloud-server-2ee65f177e4f7e09ad2287f14d564e7068d322fb.tar.gz
nextcloud-server-2ee65f177e4f7e09ad2287f14d564e7068d322fb.zip
Use the shorter phpunit syntax for mocked return values
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/tests/unit/Comments/CommentsPluginTest.php')
-rw-r--r--apps/dav/tests/unit/Comments/CommentsPluginTest.php118
1 files changed, 59 insertions, 59 deletions
diff --git a/apps/dav/tests/unit/Comments/CommentsPluginTest.php b/apps/dav/tests/unit/Comments/CommentsPluginTest.php
index 0ffcf145d81..4929eac3ecc 100644
--- a/apps/dav/tests/unit/Comments/CommentsPluginTest.php
+++ b/apps/dav/tests/unit/Comments/CommentsPluginTest.php
@@ -99,17 +99,17 @@ class CommentsPluginTest extends \Test\TestCase {
->getMock();
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
->method('getName')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$node->expects($this->once())
->method('getId')
- ->will($this->returnValue('42'));
+ ->willReturn('42');
$node->expects($this->once())
->method('setReadMarker')
@@ -118,11 +118,11 @@ class CommentsPluginTest extends \Test\TestCase {
$this->commentsManager->expects($this->once())
->method('create')
->with('users', 'alice', 'files', '42')
- ->will($this->returnValue($comment));
+ ->willReturn($comment);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
// technically, this is a shortcut. Inbetween EntityTypeCollection would
// be returned, but doing it exactly right would not be really
@@ -131,7 +131,7 @@ class CommentsPluginTest extends \Test\TestCase {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -143,20 +143,20 @@ class CommentsPluginTest extends \Test\TestCase {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/' . $path));
+ ->willReturn('/' . $path);
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/json'));
+ ->willReturn('application/json');
$request->expects($this->once())
->method('getUrl')
- ->will($this->returnValue('http://example.com/dav/' . $path));
+ ->willReturn('http://example.com/dav/' . $path);
$response->expects($this->once())
->method('setHeader')
@@ -164,7 +164,7 @@ class CommentsPluginTest extends \Test\TestCase {
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->httpPost($request, $response);
@@ -229,7 +229,7 @@ class CommentsPluginTest extends \Test\TestCase {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/' . $path));
+ ->willReturn('/' . $path);
$request->expects($this->never())
->method('getBodyAsString');
@@ -246,7 +246,7 @@ class CommentsPluginTest extends \Test\TestCase {
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->httpPost($request, $response);
@@ -285,10 +285,10 @@ class CommentsPluginTest extends \Test\TestCase {
->getMock();
$node->expects($this->once())
->method('getName')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$node->expects($this->once())
->method('getId')
- ->will($this->returnValue('42'));
+ ->willReturn('42');
$this->commentsManager->expects($this->never())
->method('create');
@@ -303,7 +303,7 @@ class CommentsPluginTest extends \Test\TestCase {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -315,16 +315,16 @@ class CommentsPluginTest extends \Test\TestCase {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/' . $path));
+ ->willReturn('/' . $path);
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/json'));
+ ->willReturn('application/json');
$request->expects($this->never())
->method('getUrl');
@@ -334,7 +334,7 @@ class CommentsPluginTest extends \Test\TestCase {
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->httpPost($request, $response);
@@ -373,10 +373,10 @@ class CommentsPluginTest extends \Test\TestCase {
->getMock();
$node->expects($this->once())
->method('getName')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$node->expects($this->once())
->method('getId')
- ->will($this->returnValue('42'));
+ ->willReturn('42');
$this->commentsManager->expects($this->never())
->method('create');
@@ -391,7 +391,7 @@ class CommentsPluginTest extends \Test\TestCase {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -403,16 +403,16 @@ class CommentsPluginTest extends \Test\TestCase {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/' . $path));
+ ->willReturn('/' . $path);
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/trumpscript'));
+ ->willReturn('application/trumpscript');
$request->expects($this->never())
->method('getUrl');
@@ -422,7 +422,7 @@ class CommentsPluginTest extends \Test\TestCase {
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->httpPost($request, $response);
@@ -457,26 +457,26 @@ class CommentsPluginTest extends \Test\TestCase {
->getMock();
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
->method('getName')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$node->expects($this->once())
->method('getId')
- ->will($this->returnValue('42'));
+ ->willReturn('42');
$this->commentsManager->expects($this->once())
->method('create')
->with('users', 'alice', 'files', '42')
- ->will($this->returnValue($comment));
+ ->willReturn($comment);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
// technically, this is a shortcut. Inbetween EntityTypeCollection would
// be returned, but doing it exactly right would not be really
@@ -485,7 +485,7 @@ class CommentsPluginTest extends \Test\TestCase {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -497,16 +497,16 @@ class CommentsPluginTest extends \Test\TestCase {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/' . $path));
+ ->willReturn('/' . $path);
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/json'));
+ ->willReturn('application/json');
$request->expects($this->never())
->method('getUrl');
@@ -516,7 +516,7 @@ class CommentsPluginTest extends \Test\TestCase {
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->httpPost($request, $response);
@@ -551,17 +551,17 @@ class CommentsPluginTest extends \Test\TestCase {
->getMock();
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
->method('getName')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$node->expects($this->once())
->method('getId')
- ->will($this->returnValue('42'));
+ ->willReturn('42');
$node->expects($this->never())
->method('setReadMarker');
@@ -569,11 +569,11 @@ class CommentsPluginTest extends \Test\TestCase {
$this->commentsManager->expects($this->once())
->method('create')
->with('users', 'alice', 'files', '42')
- ->will($this->returnValue($comment));
+ ->willReturn($comment);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
// technically, this is a shortcut. Inbetween EntityTypeCollection would
// be returned, but doing it exactly right would not be really
@@ -582,7 +582,7 @@ class CommentsPluginTest extends \Test\TestCase {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -594,23 +594,23 @@ class CommentsPluginTest extends \Test\TestCase {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/' . $path));
+ ->willReturn('/' . $path);
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/json'));
+ ->willReturn('application/json');
$response->expects($this->never())
->method('setHeader');
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->httpPost($request, $response);
@@ -625,15 +625,15 @@ class CommentsPluginTest extends \Test\TestCase {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue(
+ ->willReturn(
$this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock()
- ));
+ );
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->onReport(CommentsPluginImplementation::REPORT_NAME, [], '/' . $path);
@@ -648,15 +648,15 @@ class CommentsPluginTest extends \Test\TestCase {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue(
+ ->willReturn(
$this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock()
- ));
+ );
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->onReport('{whoever}whatever', [], '/' . $path);
@@ -686,7 +686,7 @@ class CommentsPluginTest extends \Test\TestCase {
$node->expects($this->once())
->method('findChildren')
->with(5, 10, null)
- ->will($this->returnValue([]));
+ ->willReturn([]);
$response = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
@@ -706,11 +706,11 @@ class CommentsPluginTest extends \Test\TestCase {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->server->httpResponse = $response;
$this->plugin->initialize($this->server);
@@ -741,7 +741,7 @@ class CommentsPluginTest extends \Test\TestCase {
$node->expects($this->once())
->method('findChildren')
->with(5, 10, new \DateTime($parameters[2]['value']))
- ->will($this->returnValue([]));
+ ->willReturn([]);
$response = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
@@ -761,11 +761,11 @@ class CommentsPluginTest extends \Test\TestCase {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->server->httpResponse = $response;
$this->plugin->initialize($this->server);