diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/App/AppStore/Fetcher/AppFetcherTest.php | 30 | ||||
-rw-r--r-- | tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php | 24 | ||||
-rw-r--r-- | tests/lib/Preview/GeneratorTest.php | 3 | ||||
-rw-r--r-- | tests/redis.config.php | 12 |
4 files changed, 49 insertions, 20 deletions
diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php index 4a5222fa915..6c0d079a204 100644 --- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php @@ -72,26 +72,16 @@ EOD; } public function testGetWithFilter() { - $this->config - ->expects($this->at(0)) - ->method('getSystemValue') - ->with('appstoreenabled', true) - ->willReturn(true); - $this->config - ->expects($this->at(1)) - ->method('getSystemValue') - ->with('appstoreenabled', true) - ->willReturn(true); - $this->config - ->expects($this->at(2)) - ->method('getSystemValue') - ->with('version') - ->willReturn('11.0.0.2'); - $this->config - ->expects($this->at(3)) - ->method('getSystemValue') - ->with('version') - ->willReturn('11.0.0.2'); + $this->config->method('getSystemValue') + ->willReturnCallback(function($key, $default) { + if ($key === 'appstoreenabled') { + return true; + } else if ($key === 'version') { + return '11.0.0.2'; + } else { + return $default; + } + }); $file = $this->createMock(ISimpleFile::class); $folder = $this->createMock(ISimpleFolder::class); diff --git a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php index 2d82fa5d68e..353c8d6f58f 100644 --- a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php +++ b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php @@ -79,4 +79,28 @@ class EMailproviderTest extends TestCase { $this->provider->process($entry); } + public function testProcessEmptyAddress() { + $entry = $this->createMock(IEntry::class); + $action = $this->createMock(ILinkAction::class); + $iconUrl = 'https://example.com/img/actions/icon.svg'; + $this->urlGenerator->expects($this->once()) + ->method('imagePath') + ->willReturn('img/actions/icon.svg'); + $this->urlGenerator->expects($this->once()) + ->method('getAbsoluteURL') + ->with('img/actions/icon.svg') + ->willReturn($iconUrl); + $entry->expects($this->once()) + ->method('getEMailAddresses') + ->willReturn([ + '', + ]); + $this->actionFactory->expects($this->never()) + ->method('newEMailAction'); + $entry->expects($this->never()) + ->method('addAction'); + + $this->provider->process($entry); + } + } diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php index 50d46ae932d..f1383b0691b 100644 --- a/tests/lib/Preview/GeneratorTest.php +++ b/tests/lib/Preview/GeneratorTest.php @@ -169,6 +169,7 @@ class GeneratorTest extends \Test\TestCase { $image = $this->createMock(IImage::class); $image->method('width')->willReturn(2048); $image->method('height')->willReturn(2048); + $image->method('valid')->willReturn(true); $this->helper->method('getThumbnail') ->will($this->returnCallback(function ($provider, $file, $x, $y) use ($invalidProvider, $validProvider, $image) { @@ -217,6 +218,7 @@ class GeneratorTest extends \Test\TestCase { ->with(128); $image->method('data') ->willReturn('my resized data'); + $image->method('valid')->willReturn(true); $previewFile->expects($this->once()) ->method('putContent') @@ -379,6 +381,7 @@ class GeneratorTest extends \Test\TestCase { ->willReturn($image); $image->method('height')->willReturn($maxY); $image->method('width')->willReturn($maxX); + $image->method('valid')->willReturn(true); $preview = $this->createMock(ISimpleFile::class); $previewFolder->method('newFile') diff --git a/tests/redis.config.php b/tests/redis.config.php new file mode 100644 index 00000000000..2ff46ec6728 --- /dev/null +++ b/tests/redis.config.php @@ -0,0 +1,12 @@ +<?php + +$CONFIG = [ + 'memcache.local' => '\\OC\\Memcache\\Redis', + 'memcache.distributed' => '\\OC\\Memcache\\Redis', + 'memcache.locking' => '\\OC\\Memcache\\Redis', + 'redis' => [ + 'host' => 'localhost', + 'port' => 6379, + 'timeout' => 0, + ], +]; |