summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-14 17:32:49 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-14 17:32:49 +0200
commit160a0dfebaeb21cc75d7166dfbac6d0ef1a51460 (patch)
tree28e2555c97462d60356ef933d5c71c5326649747 /tests
parentacc2df1251a1c1b9ec5ede13bdf46d516dc64b0d (diff)
convert array() to []
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/articleenhancer/EnhancerTest.php4
-rw-r--r--tests/unit/articleenhancer/RegexArticleEnhancerTest.php2
-rw-r--r--tests/unit/articleenhancer/XPathArticleEnhancerTest.php28
-rw-r--r--tests/unit/businesslayer/FeedBusinessLayerTest.php52
-rw-r--r--tests/unit/businesslayer/FolderBusinessLayerTest.php18
-rw-r--r--tests/unit/businesslayer/ItemBusinessLayerTest.php2
-rw-r--r--tests/unit/config/AppConfigTest.php115
-rw-r--r--tests/unit/controller/EntityApiSerializerTest.php14
-rw-r--r--tests/unit/controller/ExportControllerTest.php10
-rw-r--r--tests/unit/controller/FeedApiControllerTest.php36
-rw-r--r--tests/unit/controller/FeedControllerTest.php101
-rw-r--r--tests/unit/controller/FolderApiControllerTest.php8
-rw-r--r--tests/unit/controller/FolderControllerTest.php23
-rw-r--r--tests/unit/controller/ItemApiControllerTest.php54
-rw-r--r--tests/unit/controller/ItemControllerTest.php30
-rw-r--r--tests/unit/controller/JSONHttpErrorTest.php2
-rw-r--r--tests/unit/controller/PageControllerTest.php4
-rw-r--r--tests/unit/db/FeedMapperTest.php109
-rw-r--r--tests/unit/db/FeedTest.php4
-rw-r--r--tests/unit/db/FolderMapperTest.php65
-rw-r--r--tests/unit/db/FolderTest.php4
-rw-r--r--tests/unit/db/ItemMapperTest.php79
-rw-r--r--tests/unit/db/ItemTest.php16
-rw-r--r--tests/unit/db/postgres/ItemMapperTest.php29
-rw-r--r--tests/unit/fetcher/FeedFetcherTest.php40
-rw-r--r--tests/unit/utility/ConfigTest.php6
-rw-r--r--tests/unit/utility/OPMLExporterTest.php13
27 files changed, 381 insertions, 487 deletions
diff --git a/tests/unit/articleenhancer/EnhancerTest.php b/tests/unit/articleenhancer/EnhancerTest.php
index 5c54816a8..4a72e19a8 100644
--- a/tests/unit/articleenhancer/EnhancerTest.php
+++ b/tests/unit/articleenhancer/EnhancerTest.php
@@ -37,14 +37,14 @@ class EnhancerTest extends \PHPUnit_Framework_TestCase {
public function testEnhanceSetsCorrectHash(){
$item = new Item();
$item->setUrl('hi');
- $urls = array(
+ $urls = [
'https://test.com',
'https://www.test.com',
'https://test.com/',
'http://test.com',
'http://test.com/',
'http://www.test.com'
- );
+ ];
for ($i=0; $i < count($urls); $i++) {
$this->articleEnhancer->expects($this->at($i))
->method('enhance')
diff --git a/tests/unit/articleenhancer/RegexArticleEnhancerTest.php b/tests/unit/articleenhancer/RegexArticleEnhancerTest.php
index b88abc985..f464c9275 100644
--- a/tests/unit/articleenhancer/RegexArticleEnhancerTest.php
+++ b/tests/unit/articleenhancer/RegexArticleEnhancerTest.php
@@ -25,7 +25,7 @@ class RegexArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
$item = new Item();
$item->setBody('atests is a nice thing');
$item->setUrl('http://john.com');
- $regex = array("%tes(ts)%" => "heho$1tests");
+ $regex = ["%tes(ts)%" => "heho$1tests"];
$regexEnhancer = new RegexArticleEnhancer('%john.com%', $regex);
$item = $regexEnhancer->enhance($item);
diff --git a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
index a0120a6f3..55493bed7 100644
--- a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
+++ b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
@@ -57,12 +57,12 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
$this->testEnhancer = new XPathArticleEnhancer(
$this->fileFactory,
- array(
+ [
'/explosm.net\/comics/' => '//*[@id=\'maincontent\']/div[2]/div/span',
'/explosm.net\/shorts/' => '//*[@id=\'maincontent\']/div/div',
'/explosm.net\/all/' => '//body/*',
'/themerepublic.net/' => '//*[@class=\'post hentry\']'
- ),
+ ],
$this->config
);
$this->redirects = 5;
@@ -73,7 +73,7 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
public function testXPathUsesNoProxy() {
$file = new \stdClass;
- $file->headers = array("content-type"=>"text/html; charset=utf-8");
+ $file->headers = ["content-type"=>"text/html; charset=utf-8"];
$file->body = '';
$item = new Item();
$item->setUrl('https://www.explosm.net/comics/312');
@@ -117,17 +117,17 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
$this->testEnhancer = new XPathArticleEnhancer(
$this->fileFactory,
- array(
+ [
'/explosm.net\/comics/' => '//*[@id=\'maincontent\']/div[2]/div/span',
'/explosm.net\/shorts/' => '//*[@id=\'maincontent\']/div/div',
'/explosm.net\/all/' => '//body/*',
'/themerepublic.net/' => '//*[@class=\'post hentry\']'
- ),
+ ],
$this->config
);
$file = new \stdClass;
- $file->headers = array("content-type"=>"text/html; charset=utf-8");
+ $file->headers = ["content-type"=>"text/html; charset=utf-8"];
$file->body = '';
$item = new Item();
$item->setUrl('https://www.explosm.net/comics/312');
@@ -165,7 +165,7 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
public function testDoesModifiyArticlesThatMatch() {
$file = new \stdClass;
- $file->headers = array("content-type"=>"text/html; charset=utf-8");
+ $file->headers = ["content-type"=>"text/html; charset=utf-8"];
$file->body = '<html>
<body>
<div id="maincontent">
@@ -194,7 +194,7 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
public function testDoesModifiyAllArticlesThatMatch() {
$file = new \stdClass;
- $file->headers = array("content-type"=>"text/html; charset=utf-8");
+ $file->headers = ["content-type"=>"text/html; charset=utf-8"];
$file->body = '<html>
<body>
<div id="maincontent">
@@ -223,7 +223,7 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
public function testModificationHandlesEmptyResults() {
$file = new \stdClass;
- $file->headers = array("content-type"=>"text/html; charset=utf-8");
+ $file->headers = ["content-type"=>"text/html; charset=utf-8"];
$file->body = '<html>
<body>
<div id="maincontent">
@@ -250,7 +250,7 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
public function testModificationDoesNotBreakOnEmptyDom() {
$file = new \stdClass;
- $file->headers = array("content-type"=>"text/html; charset=utf-8");
+ $file->headers = ["content-type"=>"text/html; charset=utf-8"];
$file->body = '';
$item = new Item();
$item->setUrl('https://www.explosm.net/comics/312');
@@ -272,7 +272,7 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
public function testModificationDoesNotBreakOnBrokenDom() {
$file = new \stdClass;
- $file->headers = array("content-type"=>"text/html; charset=utf-8");
+ $file->headers = ["content-type"=>"text/html; charset=utf-8"];
$file->body = '<html/><p>
<body>
<div id="maincontent">
@@ -299,7 +299,7 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
public function testTransformRelativeUrls() {
$file = new \stdClass;
- $file->headers = array("content-type"=>"text/html; charset=utf-8");
+ $file->headers = ["content-type"=>"text/html; charset=utf-8"];
$file->body = '<html>
<body>
<a href="../a/relative/url.html?a=1#b">link</a>
@@ -326,7 +326,7 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
public function testTransformRelativeUrlSpecials() {
$file = new \stdClass;
- $file->headers = array("content-type"=>"text/html; charset=utf-8");
+ $file->headers = ["content-type"=>"text/html; charset=utf-8"];
$file->body = '<html>
<body>
<img src="relative/url.png?a=1&b=2">
@@ -351,7 +351,7 @@ class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
public function testDontTransformAbsoluteUrlsAndMails() {
$file = new \stdClass;
- $file->headers = array("content-type"=>"text/html; charset=utf-8");
+ $file->headers = ["content-type"=>"text/html; charset=utf-8"];
$file->body = '<html>
<body>
<img src="http://www.url.com/absolute/url.png">
diff --git a/tests/unit/businesslayer/FeedBusinessLayerTest.php b/tests/unit/businesslayer/FeedBusinessLayerTest.php
index 65cd3e3db..786b3016c 100644
--- a/tests/unit/businesslayer/FeedBusinessLayerTest.php
+++ b/tests/unit/businesslayer/FeedBusinessLayerTest.php
@@ -46,10 +46,10 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
'\OCP\ILogger')
->disableOriginalConstructor()
->getMock();
- $this->loggerParams = array('hi');
+ $this->loggerParams = ['hi'];
$this->time = 222;
$this->autoPurgeMinimumInterval = 10;
- $timeFactory = $this->getMock('TimeFactory', array('getTime'));
+ $timeFactory = $this->getMock('TimeFactory', ['getTime']);
$timeFactory->expects($this->any())
->method('getTime')
->will($this->returnValue($this->time));
@@ -68,7 +68,7 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$this->enhancer = $this->getMockBuilder('\OCA\News\ArticleEnhancer\Enhancer')
->disableOriginalConstructor()
->getMock();
- $this->purifier = $this->getMock('purifier', array('purify'));
+ $this->purifier = $this->getMock('purifier', ['purify']);
$config = $this->getMockBuilder(
'\OCA\News\Utility\Config')
->disableOriginalConstructor()
@@ -120,10 +120,10 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$item1->setGuidHash('hi');
$item2 = new Item();
$item2->setGuidHash('yo');
- $return = array(
+ $return = [
$createdFeed,
- array($item1, $item2)
- );
+ [$item1, $item2]
+ ];
$this->feedMapper->expects($this->once())
->method('findByUrlHash')
@@ -196,10 +196,10 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$item1->setGuidHash('hi');
$item2 = new Item();
$item2->setGuidHash('yo');
- $return = array(
+ $return = [
$createdFeed,
- array($item1, $item2)
- );
+ [$item1, $item2]
+ ];
$this->feedMapper->expects($this->once())
->method('findByUrlHash')
@@ -257,13 +257,11 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$item = new Item();
$item->setGuidHash(md5('hi'));
$item->setFeedId(3);
- $items = array(
- $item
- );
+ $items = [$item];
$ex = new DoesNotExistException('hi');
- $fetchReturn = array($feed, $items);
+ $fetchReturn = [$feed, $items];
$this->feedMapper->expects($this->at(0))
->method('find')
@@ -314,9 +312,7 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$item = new Item();
$item->setGuidHash(md5('hi'));
$item->setFeedId(3);
- $items = array(
- $item
- );
+ $items = [$item];
$this->feedMapper->expects($this->any())
->method('find')
@@ -324,7 +320,7 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$this->fetcher->expects($this->once())
->method('fetch')
- ->will($this->returnValue(array($feed, $items)));
+ ->will($this->returnValue([$feed, $items]));
$this->feedMapper->expects($this->once())
->method('update')
@@ -387,14 +383,12 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$item->setGuidHash(md5('hi'));
$item->setPubDate(3333);
$item->setId(4);
- $items = array(
- $item
- );
+ $items = [$item];
$item2 = new Item();
$item2->setPubDate(111);
- $fetchReturn = array($feed, $items);
+ $fetchReturn = [$feed, $items];
$ex = new DoesNotExistException('');
$this->feedMapper->expects($this->at(0))
@@ -499,7 +493,7 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$feed->setFolderId(0);
$feed->setPreventUpdate(true);
- $feeds = array($feed);
+ $feeds = [$feed];
$item = new Item();
$item->setFeedId(3);
@@ -514,9 +508,9 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$item->setUnstarred();
$item->setLastModified($this->time);
- $json = $item->toExport(array('feed3' => $feed));
+ $json = $item->toExport(['feed3' => $feed]);
- $items = array($json);
+ $items = [$json];
$this->feedMapper->expects($this->once())
->method('findAllFromUser')
@@ -554,7 +548,7 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$feed->setFolderId(0);
$feed->setPreventUpdate(true);
- $feeds = array($feed);
+ $feeds = [$feed];
$item = new Item();
$item->setFeedId(3);
@@ -569,11 +563,11 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$item->setUnstarred();
$item->setLastModified($this->time);
- $json = $item->toExport(array('feed3' => $feed));
+ $json = $item->toExport(['feed3' => $feed]);
$json2 = $json;
$json2['feedLink'] = 'http://test.com'; // believe it or not this copies stuff :D
- $items = array($json, $json2);
+ $items = [$json, $json2];
$insertFeed = new Feed();
$insertFeed->setLink('http://owncloud/nofeed');
@@ -666,7 +660,7 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$feed1->setId(3);
$feed2 = new Feed();
$feed2->setId(5);
- $feeds = array($feed1, $feed2);
+ $feeds = [$feed1, $feed2];
$time = $this->time - $this->autoPurgeMinimumInterval;
$this->feedMapper->expects($this->once())
@@ -689,7 +683,7 @@ class FeedBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$feed1->setId(3);
$feed2 = new Feed();
$feed2->setId(5);
- $feeds = array($feed1, $feed2);
+ $feeds = [$feed1, $feed2];
$this->feedMapper->expects($this->once())
->method('getToDelete')
diff --git a/tests/unit/businesslayer/FolderBusinessLayerTest.php b/tests/unit/businesslayer/FolderBusinessLayerTest.php
index 62f53100c..bf3cae569 100644
--- a/tests/unit/businesslayer/FolderBusinessLayerTest.php
+++ b/tests/unit/businesslayer/FolderBusinessLayerTest.php
@@ -33,7 +33,7 @@ class FolderBusinessLayerTest extends \PHPUnit_Framework_TestCase {
->disableOriginalConstructor()
->getMock();
$this->time = 222;
- $timeFactory = $this->getMock('TimeFactory', array('getTime'));
+ $timeFactory = $this->getMock('TimeFactory', ['getTime']);
$timeFactory->expects($this->any())
->method('getTime')
->will($this->returnValue($this->time));
@@ -89,9 +89,7 @@ class FolderBusinessLayerTest extends \PHPUnit_Framework_TestCase {
public function testCreateThrowsExWhenFolderNameExists(){
$folderName = 'hihi';
- $rows = array(
- array('id' => 1)
- );
+ $rows = [['id' => 1]];
$this->l10n->expects($this->once())
->method('t');
@@ -111,7 +109,7 @@ class FolderBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$this->folderMapper->expects($this->once())
->method('findByName')
->with($this->equalTo($folderName))
- ->will($this->returnValue(array()));
+ ->will($this->returnValue([]));
$this->setExpectedException('\OCA\News\BusinessLayer\BusinessLayerValidationException');
$this->folderBusinessLayer->create($folderName, 'john', 3);
@@ -158,9 +156,7 @@ class FolderBusinessLayerTest extends \PHPUnit_Framework_TestCase {
public function testRenameThrowsExWhenFolderNameExists(){
$folderName = 'hihi';
- $rows = array(
- array('id' => 1)
- );
+ $rows = [['id' => 1]];
$this->l10n->expects($this->once())
->method('t');
@@ -180,7 +176,7 @@ class FolderBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$this->folderMapper->expects($this->once())
->method('findByName')
->with($this->equalTo($folderName))
- ->will($this->returnValue(array()));
+ ->will($this->returnValue([]));
$this->setExpectedException('\OCA\News\BusinessLayer\BusinessLayerException');
$this->folderBusinessLayer->rename(3, $folderName, 'john');
@@ -227,7 +223,7 @@ class FolderBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$folder1->setId(3);
$folder2 = new Folder();
$folder2->setId(5);
- $feeds = array($folder1, $folder2);
+ $feeds = [$folder1, $folder2];
$time = $this->time - $this->autoPurgeMinimumInterval;
$this->folderMapper->expects($this->once())
@@ -250,7 +246,7 @@ class FolderBusinessLayerTest extends \PHPUnit_Framework_TestCase {
$folder1->setId(3);
$folder2 = new Folder();
$folder2->setId(5);
- $feeds = array($folder1, $folder2);
+ $feeds = [$folder1, $folder2];
$this->folderMapper->expects($this->once())
->method('getToDelete')
diff --git a/tests/unit/businesslayer/ItemBusinessLayerTest.php b/tests/unit/businesslayer/ItemBusinessLayerTest.php
index 770791ce6..1b31963c1 100644
--- a/tests/unit/businesslayer/ItemBusinessLayerTest.php
+++ b/tests/unit/businesslayer/ItemBusinessLayerTest.php
@@ -35,7 +35,7 @@ class ItemBusinessLayerTest extends \PHPUnit_Framework_TestCase {
protected function setUp(){
$this->time = 222;
- $timeFactory = $this->getMock('TimeFactory', array('getTime'));
+ $timeFactory = $this->getMock('TimeFactory', ['getTime']);
$timeFactory->expects($this->any())
->method('getTime')
->will($this->returnValue($this->time));
diff --git a/tests/unit/config/AppConfigTest.php b/tests/unit/config/AppConfigTest.php
index 8f91dd338..d785ceea4 100644
--- a/tests/unit/config/AppConfigTest.php
+++ b/tests/unit/config/AppConfigTest.php
@@ -35,13 +35,8 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
->getMock();
$phpVersion = '5.3';
$ownCloudVersion = '6.0.3';
- $installedApps = array(
- 'contacts' => '5.3',
- 'calendar' => '2.3'
- );
- $installedExtensions = array(
- 'curl' => '4.3'
- );
+ $installedApps = ['contacts' => '5.3', 'calendar' => '2.3'];
+ $installedExtensions = ['curl' => '4.3'];
$databaseType = 'oracle';
$this->config = new AppConfig($this->nav, $this->l10n,
@@ -56,7 +51,7 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
public function testNoNavigation() {
- $this->config->loadConfig(array());
+ $this->config->loadConfig([]);
$this->nav->expects($this->never())
->method('add');
@@ -64,13 +59,13 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
public function testDefaultNavigation() {
- $expected = array(
+ $expected = [
'id' => 'news',
'href' => 'news.page.index',
'order' => 10,
'icon' => 'app.svg',
'name' => 'News'
- );
+ ];
$this->l10n->expects($this->once())
->method('t')
@@ -92,23 +87,23 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
->method('add')
->with($this->equalTo($expected));
- $this->config->loadConfig(array(
+ $this->config->loadConfig([
'id' => 'news',
'name' => 'News',
- 'navigation' => array()
- ));
+ 'navigation' => []
+ ]);
$this->config->registerNavigation();
}
public function testCustomNavigation() {
- $expected = array(
+ $expected = [
'id' => 'abc',
'href' => 'abc.page.index',
'order' => 1,
'icon' => 'test.svg',
'name' => 'haha'
- );
+ ];
$this->l10n->expects($this->once())
->method('t')
@@ -130,11 +125,11 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
->method('add')
->with($this->equalTo($expected));
- $this->config->loadConfig(array(
+ $this->config->loadConfig([
'id' => 'abc',
'name' => 'News',
'navigation' => $expected
- ));
+ ]);
$this->config->registerNavigation();
}
@@ -143,11 +138,11 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
* @expectedException \OCA\News\Config\DependencyException
*/
public function testPHPVersion() {
- $this->config->loadConfig(array(
- 'dependencies' => array(
+ $this->config->loadConfig([
+ 'dependencies' => [
'php' => '5.7'
- )
- ));
+ ]
+ ]);
$this->config->testDependencies();
}
@@ -156,11 +151,11 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
* @expectedException \OCA\News\Config\DependencyException
*/
public function testOwnCloudVersion() {
- $this->config->loadConfig(array(
- 'dependencies' => array(
+ $this->config->loadConfig([
+ 'dependencies' => [
'owncloud' => '>=4.5,<=6.0.2'
- )
- ));
+ ]
+ ]);
$this->config->testDependencies();
}
@@ -169,15 +164,14 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
* @expectedException \OCA\News\Config\DependencyException
*/
public function testAppVersion() {
- $this->config->loadConfig(array(
- 'dependencies' => array(
- 'apps' =>
- array(
- 'contacts' => '5.3',
- 'calendar' => '>2.3'
- )
- )
- ));
+ $this->config->loadConfig([
+ 'dependencies' => [
+ 'apps' => [
+ 'contacts' => '5.3',
+ 'calendar' => '>2.3'
+ ]
+ ]
+ ]);
$this->config->testDependencies();
}
@@ -186,14 +180,13 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
* @expectedException \OCA\News\Config\DependencyException
*/
public function testLibsVersion() {
- $this->config->loadConfig(array(
- 'dependencies' => array(
- 'libs' =>
- array(
- 'curl' => '>=4.3,<=4.3'
- )
- )
- ));
+ $this->config->loadConfig([
+ 'dependencies' => [
+ 'libs' => [
+ 'curl' => '>=4.3,<=4.3'
+ ]
+ ]
+ ]);
$this->config->testDependencies();
}
@@ -202,14 +195,13 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
* @expectedException \OCA\News\Config\DependencyException
*/
public function testLibsExistence() {
- $this->config->loadConfig(array(
- 'dependencies' => array(
- 'libs' =>
- array(
- 'dope' => '>=4.3,<=4.3'
- )
- )
- ));
+ $this->config->loadConfig([
+ 'dependencies' => [
+ 'libs' => [
+ 'dope' => '>=4.3,<=4.3'
+ ]
+ ]
+ ]);
$this->config->testDependencies();
}
@@ -218,14 +210,13 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
* @expectedException \OCA\News\Config\DependencyException
*/
public function testAppsExistence() {
- $this->config->loadConfig(array(
- 'dependencies' => array(
- 'apps' =>
- array(
- 'news' => '>=4.3,<=4.3'
- )
- )
- ));
+ $this->config->loadConfig([
+ 'dependencies' => [
+ 'apps' => [
+ 'news' => '>=4.3,<=4.3'
+ ]
+ ]
+ ]);
$this->config->testDependencies();
}
@@ -234,11 +225,11 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
* @expectedException \OCA\News\Config\DependencyException
*/
public function testSupportedDb() {
- $this->config->loadConfig(array(
- 'databases' => array(
+ $this->config->loadConfig([
+ 'databases' => [
'pgsql', 'sqlite'
- )
- ));
+ ]
+ ]);
$this->config->testDependencies();
}
} \ No newline at end of file
diff --git a/tests/unit/controller/EntityApiSerializerTest.php b/tests/unit/controller/EntityApiSerializerTest.php
index 5541cc3be..68675824b 100644
--- a/tests/unit/controller/EntityApiSerializerTest.php
+++ b/tests/unit/controller/EntityApiSerializerTest.php
@@ -44,7 +44,7 @@ class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase {
$serializer = new EntityApiSerializer('items');
- $result = $serializer->serialize(array($item, $item2));
+ $result = $serializer->serialize([$item, $item2]);
$this->assertTrue($result['items'][0]['unread']);
$this->assertFalse($result['items'][1]['unread']);
@@ -70,10 +70,10 @@ class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase {
$serializer = new EntityApiSerializer('items');
- $in = array(
- 'items' => array($item, $item2),
+ $in = [
+ 'items' => [$item, $item2],
'test' => 1
- );
+ ];
$result = $serializer->serialize($in);
@@ -86,10 +86,10 @@ class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase {
public function noEntityNoChange() {
$serializer = new EntityApiSerializer('items');
- $in = array(
- 'items' => array('hi', '2'),
+ $in = [
+ 'items' => ['hi', '2'],
'test' => 1
- );
+ ];
$result = $serializer->serialize($in);
diff --git a/tests/unit/controller/ExportControllerTest.php b/tests/unit/controller/ExportControllerTest.php
index f41977241..fd3aece97 100644
--- a/tests/unit/controller/ExportControllerTest.php
+++ b/tests/unit/controller/ExportControllerTest.php
@@ -72,11 +72,11 @@ class ExportControllerTest extends \PHPUnit_Framework_TestCase {
$this->feedBusinessLayer->expects($this->once())
->method('findAll')
->with($this->equalTo($this->user))
- ->will($this->returnValue(array()));
+ ->will($this->returnValue([]));
$this->folderBusinessLayer->expects($this->once())
->method('findAll')
->with($this->equalTo($this->user))
- ->will($this->returnValue(array()));
+ ->will($this->returnValue([]));
$return = $this->controller->opml();
$this->assertTrue($return instanceof TextDownloadResponse);
@@ -96,11 +96,9 @@ class ExportControllerTest extends \PHPUnit_Framework_TestCase {
$feed2 = new Feed();
$feed2->setId(5);
$feed2->setLink('http://gee');
- $feeds = array($feed1, $feed2);
+ $feeds = [$feed1, $feed2];
- $articles = array(
- $item1, $item2
- );
+ $articles = [$item1, $item2];
$this->feedBusinessLayer->expects($this->once())
->method('findAll')
diff --git a/tests/unit/controller/FeedApiControllerTest.php b/tests/unit/controller/FeedApiControllerTest.php
index 79c21af28..6e18d89da 100644
--- a/tests/unit/controller/FeedApiControllerTest.php
+++ b/tests/unit/controller/FeedApiControllerTest.php
@@ -39,7 +39,7 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
protected function setUp() {
$this->user = 'tom';
- $this->loggerParams = array('hi');
+ $this->loggerParams = ['hi'];
$this->logger = $this->getMockBuilder(
'\OCP\ILogger')
->disableOriginalConstructor()
@@ -76,9 +76,7 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
public function testIndex() {
- $feeds = array(
- new Feed()
- );
+ $feeds = [new Feed()];
$starredCount = 3;
$newestItemId = 2;
@@ -97,18 +95,16 @@ class FeedApiControllerTest extends \PHPUnit_Framework_TestCase {
$response = $this->feedAPI->index();
- $this->assertEquals(array(
+ $this->assertEquals([
'feeds' => $feeds,
'starredCount' => $starredCount,
'newestItemId' => $newestItemId
- ), $response);
+ ], $response);
}
public function testIndexNoNewestItemId() {
- $feeds = array(
- new Feed()
- );
+ $feeds = [new Feed()];
$starredCount = 3;
$this->itemBusinessLayer->expects($this->once())
@@ -126,10 +122,10 @@ class FeedApiContro