aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Files
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/Files
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/Files')
-rw-r--r--apps/dav/tests/unit/Files/FileSearchBackendTest.php28
-rw-r--r--apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php8
2 files changed, 18 insertions, 18 deletions
diff --git a/apps/dav/tests/unit/Files/FileSearchBackendTest.php b/apps/dav/tests/unit/Files/FileSearchBackendTest.php
index 2f8dec62480..167b68e076c 100644
--- a/apps/dav/tests/unit/Files/FileSearchBackendTest.php
+++ b/apps/dav/tests/unit/Files/FileSearchBackendTest.php
@@ -133,9 +133,9 @@ class FileSearchBackendTest extends TestCase {
[],
$this->user
))
- ->will($this->returnValue([
+ ->willReturn([
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
- ]));
+ ]);
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_EQUAL, '{DAV:}displayname', 'foo');
$result = $this->search->search($query);
@@ -162,9 +162,9 @@ class FileSearchBackendTest extends TestCase {
[],
$this->user
))
- ->will($this->returnValue([
+ ->willReturn([
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
- ]));
+ ]);
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_EQUAL, '{DAV:}getcontenttype', 'foo');
$result = $this->search->search($query);
@@ -191,9 +191,9 @@ class FileSearchBackendTest extends TestCase {
[],
$this->user
))
- ->will($this->returnValue([
+ ->willReturn([
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
- ]));
+ ]);
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_GREATER_THAN, FilesPlugin::SIZE_PROPERTYNAME, 10);
$result = $this->search->search($query);
@@ -220,9 +220,9 @@ class FileSearchBackendTest extends TestCase {
[],
$this->user
))
- ->will($this->returnValue([
+ ->willReturn([
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
- ]));
+ ]);
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_GREATER_THAN, '{DAV:}getlastmodified', 10);
$result = $this->search->search($query);
@@ -249,9 +249,9 @@ class FileSearchBackendTest extends TestCase {
[],
$this->user
))
- ->will($this->returnValue([
+ ->willReturn([
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
- ]));
+ ]);
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_IS_COLLECTION, 'yes');
$result = $this->search->search($query);
@@ -320,12 +320,12 @@ class FileSearchBackendTest extends TestCase {
$receivedQuery = null;
$this->searchFolder
->method('search')
- ->will($this->returnCallback(function ($query) use (&$receivedQuery) {
+ ->willReturnCallback(function ($query) use (&$receivedQuery) {
$receivedQuery = $query;
return [
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
];
- }));
+ });
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_EQUAL, FilesPlugin::OWNER_ID_PROPERTYNAME, $this->user->getUID());
$this->search->search($query);
@@ -349,12 +349,12 @@ class FileSearchBackendTest extends TestCase {
$receivedQuery = null;
$this->searchFolder
->method('search')
- ->will($this->returnCallback(function ($query) use (&$receivedQuery) {
+ ->willReturnCallback(function ($query) use (&$receivedQuery) {
$receivedQuery = $query;
return [
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
];
- }));
+ });
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_EQUAL, FilesPlugin::OWNER_ID_PROPERTYNAME, $this->user->getUID());
$query->where = new \SearchDAV\Query\Operator(
diff --git a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php
index 852a22564c3..77646b2c9d1 100644
--- a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php
+++ b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php
@@ -122,13 +122,13 @@ class FilesDropPluginTest extends TestCase {
->willReturn('https://example.com');
$this->view->method('file_exists')
- ->will($this->returnCallback(function($path) {
+ ->willReturnCallback(function($path) {
if ($path === 'file.txt' || $path === '/file.txt') {
return true;
} else {
return false;
}
- }));
+ });
$this->request->expects($this->once())
->method('setUrl')
@@ -163,13 +163,13 @@ class FilesDropPluginTest extends TestCase {
->willReturn('https://example.com');
$this->view->method('file_exists')
- ->will($this->returnCallback(function($path) {
+ ->willReturnCallback(function($path) {
if ($path === 'file.txt' || $path === '/file.txt') {
return true;
} else {
return false;
}
- }));
+ });
$this->request->expects($this->once())
->method('setUrl')