aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Template
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 /tests/lib/Template
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 'tests/lib/Template')
-rw-r--r--tests/lib/Template/JSCombinerTest.php32
-rw-r--r--tests/lib/Template/SCSSCacherTest.php32
2 files changed, 32 insertions, 32 deletions
diff --git a/tests/lib/Template/JSCombinerTest.php b/tests/lib/Template/JSCombinerTest.php
index b12124ea5a9..7a2ced51725 100644
--- a/tests/lib/Template/JSCombinerTest.php
+++ b/tests/lib/Template/JSCombinerTest.php
@@ -121,7 +121,7 @@ class JSCombinerTest extends \Test\TestCase {
$fileDeps = $this->createMock(ISimpleFile::class);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $gzfile) {
+ ->willReturnCallback(function($path) use ($file, $gzfile) {
if ($path === 'combine.js') {
return $file;
} else if ($path === 'combine.js.deps') {
@@ -130,7 +130,7 @@ class JSCombinerTest extends \Test\TestCase {
return $gzfile;
}
$this->fail();
- }));
+ });
$folder->expects($this->once())
->method('newFile')
->with('combine.js.deps')
@@ -158,7 +158,7 @@ class JSCombinerTest extends \Test\TestCase {
$gzfile = $this->createMock(ISimpleFile::class);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $gzfile) {
+ ->willReturnCallback(function($path) use ($file, $gzfile) {
if ($path === 'combine.js') {
return $file;
} else if ($path === 'combine.js.deps') {
@@ -167,7 +167,7 @@ class JSCombinerTest extends \Test\TestCase {
return $gzfile;
}
$this->fail();
- }));
+ });
$folder->expects($this->once())
->method('newFile')
->with('combine.js.deps')
@@ -201,7 +201,7 @@ class JSCombinerTest extends \Test\TestCase {
->willReturn(true);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $fileDeps) {
+ ->willReturnCallback(function($path) use ($file, $fileDeps) {
if ($path === 'combine.js') {
return $file;
}
@@ -211,7 +211,7 @@ class JSCombinerTest extends \Test\TestCase {
}
$this->fail();
- }));
+ });
$actual = $this->jsCombiner->process(__DIR__, '/data/combine.json', 'awesomeapp');
$this->assertTrue($actual);
@@ -246,12 +246,12 @@ class JSCombinerTest extends \Test\TestCase {
->willReturn('{}');
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file) {
+ ->willReturnCallback(function($path) use ($file) {
if ($path === 'combine.js') {
return $file;
}
$this->fail();
- }));
+ });
$actual = $this->jsCombiner->process(__DIR__, '/data/combine.json', 'awesomeapp');
$this->assertTrue($actual);
@@ -263,7 +263,7 @@ class JSCombinerTest extends \Test\TestCase {
$file = $this->createMock(ISimpleFile::class);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file) {
+ ->willReturnCallback(function($path) use ($file) {
if ($path === 'combine.js') {
return $file;
}
@@ -271,7 +271,7 @@ class JSCombinerTest extends \Test\TestCase {
throw new NotFoundException();
}
$this->fail();
- }));
+ });
$actual = self::invokePrivate($this->jsCombiner, 'isCached', [$fileName, $folder]);
$this->assertFalse($actual);
@@ -345,7 +345,7 @@ class JSCombinerTest extends \Test\TestCase {
$folder->method('getFile')->willThrowException(new NotFoundException());
- $folder->method('newFile')->will($this->returnCallback(
+ $folder->method('newFile')->willReturnCallback(
function ($filename) use ($file, $depsFile, $gzFile) {
if ($filename === 'combine.js') {
return $file;
@@ -356,7 +356,7 @@ class JSCombinerTest extends \Test\TestCase {
}
$this->fail();
}
- ));
+ );
$file->expects($this->once())->method('putContent');
$depsFile->expects($this->once())->method('putContent');
@@ -376,7 +376,7 @@ class JSCombinerTest extends \Test\TestCase {
$path = __DIR__ . '/data/';
- $folder->method('getFile')->will($this->returnCallback(
+ $folder->method('getFile')->willReturnCallback(
function ($filename) use ($file, $depsFile, $gzFile) {
if ($filename === 'combine.js') {
return $file;
@@ -387,7 +387,7 @@ class JSCombinerTest extends \Test\TestCase {
}
$this->fail();
}
- ));
+ );
$file->expects($this->once())->method('putContent');
$depsFile->expects($this->once())->method('putContent');
@@ -444,7 +444,7 @@ var b = \'world\';
$path = __DIR__ . '/data/';
- $folder->method('getFile')->will($this->returnCallback(
+ $folder->method('getFile')->willReturnCallback(
function ($filename) use ($file, $depsFile, $gzFile) {
if ($filename === 'combine.js') {
return $file;
@@ -455,7 +455,7 @@ var b = \'world\';
}
$this->fail();
}
- ));
+ );
$file->expects($this->at(0))
->method('putContent')
diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php
index 6f9fdf1e7fb..9e8c30961fb 100644
--- a/tests/lib/Template/SCSSCacherTest.php
+++ b/tests/lib/Template/SCSSCacherTest.php
@@ -121,7 +121,7 @@ class SCSSCacherTest extends \Test\TestCase {
substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $gzfile, $filePrefix) {
+ ->willReturnCallback(function($path) use ($file, $gzfile, $filePrefix) {
if ($path === $filePrefix.'styles.css') {
return $file;
} else if ($path === $filePrefix.'styles.css.deps') {
@@ -131,7 +131,7 @@ class SCSSCacherTest extends \Test\TestCase {
} else {
$this->fail();
}
- }));
+ });
$folder->expects($this->once())
->method('newFile')
->with($filePrefix.'styles.css.deps')
@@ -161,7 +161,7 @@ class SCSSCacherTest extends \Test\TestCase {
substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $gzfile, $filePrefix) {
+ ->willReturnCallback(function($path) use ($file, $gzfile, $filePrefix) {
if ($path === $filePrefix.'styles.css') {
return $file;
} else if ($path === $filePrefix.'styles.css.deps') {
@@ -171,7 +171,7 @@ class SCSSCacherTest extends \Test\TestCase {
}else {
$this->fail();
}
- }));
+ });
$folder->expects($this->once())
->method('newFile')
->with($filePrefix.'styles.css.deps')
@@ -197,7 +197,7 @@ class SCSSCacherTest extends \Test\TestCase {
substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
$folder->method('getFile')
- ->will($this->returnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
+ ->willReturnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
if ($name === $filePrefix.'styles.css') {
return $file;
} else if ($name === $filePrefix.'styles.css.deps') {
@@ -206,7 +206,7 @@ class SCSSCacherTest extends \Test\TestCase {
return $gzFile;
}
$this->fail();
- }));
+ });
$this->iconsCacher->expects($this->any())
->method('setIconsCss')
@@ -235,7 +235,7 @@ class SCSSCacherTest extends \Test\TestCase {
$filePrefix = substr(md5(\OC_Util::getVersionString('core')), 0, 4) . '-' .
substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
$folder->method('getFile')
- ->will($this->returnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
+ ->willReturnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
if ($name === $filePrefix.'styles.css') {
return $file;
} else if ($name === $filePrefix.'styles.css.deps') {
@@ -244,7 +244,7 @@ class SCSSCacherTest extends \Test\TestCase {
return $gzFile;
}
$this->fail();
- }));
+ });
$this->iconsCacher->expects($this->any())
->method('setIconsCss')
@@ -273,7 +273,7 @@ class SCSSCacherTest extends \Test\TestCase {
$file->expects($this->once())->method('getSize')->willReturn(1);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file) {
+ ->willReturnCallback(function($path) use ($file) {
if ($path === 'styles.css') {
return $file;
} else if ($path === 'styles.css.deps') {
@@ -281,7 +281,7 @@ class SCSSCacherTest extends \Test\TestCase {
} else {
$this->fail();
}
- }));
+ });
$this->appData->expects($this->any())
->method('getFolder')
@@ -301,7 +301,7 @@ class SCSSCacherTest extends \Test\TestCase {
$path = \OC::$SERVERROOT . '/core/css/';
$folder->method('getFile')->willThrowException(new NotFoundException());
- $folder->method('newFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
+ $folder->method('newFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
if ($fileName === 'styles.css') {
return $file;
} else if ($fileName === 'styles.css.deps') {
@@ -310,7 +310,7 @@ class SCSSCacherTest extends \Test\TestCase {
return $gzipFile;
}
throw new \Exception();
- }));
+ });
$this->iconsCacher->expects($this->any())
->method('setIconsCss')
@@ -335,7 +335,7 @@ class SCSSCacherTest extends \Test\TestCase {
$webDir = "core/css";
$path = \OC::$SERVERROOT;
- $folder->method('getFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
+ $folder->method('getFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
if ($fileName === 'styles.css') {
return $file;
} else if ($fileName === 'styles.css.deps') {
@@ -344,7 +344,7 @@ class SCSSCacherTest extends \Test\TestCase {
return $gzipFile;
}
throw new \Exception();
- }));
+ });
$file->expects($this->once())->method('putContent');
$depsFile->expects($this->once())->method('putContent');
@@ -369,7 +369,7 @@ class SCSSCacherTest extends \Test\TestCase {
$webDir = "tests/data/scss";
$path = \OC::$SERVERROOT . $webDir;
- $folder->method('getFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
+ $folder->method('getFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
if ($fileName === 'styles-success.css') {
return $file;
} else if ($fileName === 'styles-success.css.deps') {
@@ -378,7 +378,7 @@ class SCSSCacherTest extends \Test\TestCase {
return $gzipFile;
}
throw new \Exception();
- }));
+ });
$this->iconsCacher->expects($this->at(0))
->method('setIconsCss')