diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-25 22:21:27 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-25 22:21:27 +0100 |
commit | 2ee65f177e4f7e09ad2287f14d564e7068d322fb (patch) | |
tree | 39075e87ea7927e20e8956824cb7c49bf626b178 /tests/Core/Command | |
parent | 3cf321fdfc4235a87015a9af2f59c63220016c65 (diff) | |
download | nextcloud-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/Core/Command')
-rw-r--r-- | tests/Core/Command/Config/System/SetConfigTest.php | 8 | ||||
-rw-r--r-- | tests/Core/Command/Log/FileTest.php | 16 | ||||
-rw-r--r-- | tests/Core/Command/Log/ManageTest.php | 12 | ||||
-rw-r--r-- | tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php | 16 |
4 files changed, 26 insertions, 26 deletions
diff --git a/tests/Core/Command/Config/System/SetConfigTest.php b/tests/Core/Command/Config/System/SetConfigTest.php index 9b34afed691..1ed7cf2758f 100644 --- a/tests/Core/Command/Config/System/SetConfigTest.php +++ b/tests/Core/Command/Config/System/SetConfigTest.php @@ -83,10 +83,10 @@ class SetConfigTest extends TestCase { ->with('name') ->willReturn($configNames); $this->consoleInput->method('getOption') - ->will($this->returnValueMap([ + ->willReturnMap([ ['value', $newValue], ['type', 'string'], - ])); + ]); $this->invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } @@ -119,11 +119,11 @@ class SetConfigTest extends TestCase { ->with('name') ->willReturn($configNames); $this->consoleInput->method('getOption') - ->will($this->returnValueMap([ + ->willReturnMap([ ['value', 'foobar'], ['type', 'string'], ['update-only', true], - ])); + ]); $this->invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php index 524a193d86f..c1d005e0c56 100644 --- a/tests/Core/Command/Log/FileTest.php +++ b/tests/Core/Command/Log/FileTest.php @@ -53,9 +53,9 @@ class FileTest extends TestCase { public function testEnable() { $this->consoleInput->method('getOption') - ->will($this->returnValueMap([ + ->willReturnMap([ ['enable', 'true'] - ])); + ]); $this->config->expects($this->once()) ->method('setSystemValue') ->with('log_type', 'file'); @@ -65,9 +65,9 @@ class FileTest extends TestCase { public function testChangeFile() { $this->consoleInput->method('getOption') - ->will($this->returnValueMap([ + ->willReturnMap([ ['file', '/foo/bar/file.log'] - ])); + ]); $this->config->expects($this->once()) ->method('setSystemValue') ->with('logfile', '/foo/bar/file.log'); @@ -89,9 +89,9 @@ class FileTest extends TestCase { */ public function testChangeRotateSize($optionValue, $configValue) { $this->consoleInput->method('getOption') - ->will($this->returnValueMap([ + ->willReturnMap([ ['rotate-size', $optionValue] - ])); + ]); $this->config->expects($this->once()) ->method('setSystemValue') ->with('log_rotate_size', $configValue); @@ -101,12 +101,12 @@ class FileTest extends TestCase { public function testGetConfiguration() { $this->config->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['log_type', 'file', 'log_type_value'], ['datadirectory', \OC::$SERVERROOT.'/data', '/data/directory/'], ['logfile', '/data/directory/nextcloud.log', '/var/log/nextcloud.log'], ['log_rotate_size', 100 * 1024 * 1024, 5 * 1024 * 1024], - ])); + ]); $this->consoleOutput->expects($this->at(0)) ->method('writeln') diff --git a/tests/Core/Command/Log/ManageTest.php b/tests/Core/Command/Log/ManageTest.php index d73bc7ed9c2..cae6293abd1 100644 --- a/tests/Core/Command/Log/ManageTest.php +++ b/tests/Core/Command/Log/ManageTest.php @@ -53,9 +53,9 @@ class ManageTest extends TestCase { public function testChangeBackend() { $this->consoleInput->method('getOption') - ->will($this->returnValueMap([ + ->willReturnMap([ ['backend', 'syslog'] - ])); + ]); $this->config->expects($this->once()) ->method('setSystemValue') ->with('log_type', 'syslog'); @@ -65,9 +65,9 @@ class ManageTest extends TestCase { public function testChangeLevel() { $this->consoleInput->method('getOption') - ->will($this->returnValueMap([ + ->willReturnMap([ ['level', 'debug'] - ])); + ]); $this->config->expects($this->once()) ->method('setSystemValue') ->with('loglevel', 0); @@ -77,9 +77,9 @@ class ManageTest extends TestCase { public function testChangeTimezone() { $this->consoleInput->method('getOption') - ->will($this->returnValueMap([ + ->willReturnMap([ ['timezone', 'UTC'] - ])); + ]); $this->config->expects($this->once()) ->method('setSystemValue') ->with('logtimezone', 'UTC'); diff --git a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php index 32608796864..d7238921af5 100644 --- a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php +++ b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php @@ -101,16 +101,16 @@ class UpdateDBTest extends TestCase { ]); $this->loader->expects($this->exactly(2)) ->method('exists') - ->will($this->returnValueMap([ + ->willReturnMap([ ['testing/existingmimetype', true], ['testing/newmimetype', false], - ])); + ]); $this->loader->expects($this->exactly(2)) ->method('getId') - ->will($this->returnValueMap([ + ->willReturnMap([ ['testing/existingmimetype', 1], ['testing/newmimetype', 2], - ])); + ]); $this->loader->expects($this->once()) ->method('updateFilecache') @@ -158,14 +158,14 @@ class UpdateDBTest extends TestCase { ]); $this->loader->expects($this->exactly(1)) ->method('exists') - ->will($this->returnValueMap([ + ->willReturnMap([ ['testing/existingmimetype', true], - ])); + ]); $this->loader->expects($this->exactly(1)) ->method('getId') - ->will($this->returnValueMap([ + ->willReturnMap([ ['testing/existingmimetype', 1], - ])); + ]); $this->loader->expects($this->once()) ->method('updateFilecache') |