summaryrefslogtreecommitdiffstats
path: root/tests/unit/businesslayer
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/unit/businesslayer
parentacc2df1251a1c1b9ec5ede13bdf46d516dc64b0d (diff)
convert array() to []
Diffstat (limited to 'tests/unit/businesslayer')
-rw-r--r--tests/unit/businesslayer/FeedBusinessLayerTest.php52
-rw-r--r--tests/unit/businesslayer/FolderBusinessLayerTest.php18
-rw-r--r--tests/unit/businesslayer/ItemBusinessLayerTest.php2
3 files changed, 31 insertions, 41 deletions
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));