summaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-09-16 16:24:20 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-09-16 16:24:20 +0200
commit9e36ef31f9bf16d43326fd047619ada5ff16e072 (patch)
treee228816adedacfed87eb08e8bc86658536cbbe86 /tests/unit
parent6a7ac3d9da3dea4130eb08a07a0a0603418d54ab (diff)
parent21728afff571adfc508cf5fa473d094946ef188f (diff)
merge
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/articleenhancer/EnhancerTest.php6
-rw-r--r--tests/unit/articleenhancer/RegexArticleEnhancerTest.php4
-rw-r--r--tests/unit/articleenhancer/XPathArticleEnhancerTest.php30
-rw-r--r--tests/unit/config/AppConfigTest.php119
-rw-r--r--tests/unit/controller/ApiControllerTest.php132
-rw-r--r--tests/unit/controller/EntityApiSerializerTest.php99
-rw-r--r--tests/unit/controller/ExportControllerTest.php59
-rw-r--r--tests/unit/controller/FeedApiControllerTest.php374
-rw-r--r--tests/unit/controller/FeedControllerTest.php492
-rw-r--r--tests/unit/controller/FolderApiControllerTest.php264
-rw-r--r--tests/unit/controller/FolderControllerTest.php319
-rw-r--r--tests/unit/controller/ItemApiControllerTest.php479
-rw-r--r--tests/unit/controller/ItemControllerTest.php397
-rw-r--r--tests/unit/controller/JSONHttpErrorTest.php34
-rw-r--r--tests/unit/controller/PageControllerTest.php105
-rw-r--r--tests/unit/controller/UtilityApiControllerTest.php72
-rw-r--r--tests/unit/db/FeedMapperTest.php123
-rw-r--r--tests/unit/db/FeedTest.php44
-rw-r--r--tests/unit/db/FolderMapperTest.php103
-rw-r--r--tests/unit/db/FolderTest.php6
-rw-r--r--tests/unit/db/ItemMapperTest.php100
-rw-r--r--tests/unit/db/ItemTest.php38
-rw-r--r--tests/unit/db/MapperFactoryTest.php5
-rw-r--r--tests/unit/db/postgres/ItemMapperTest.php43
-rw-r--r--tests/unit/fetcher/FeedFetcherTest.php42
-rw-r--r--tests/unit/fetcher/FetcherTest.php2
-rw-r--r--tests/unit/http/DownloadResponseTest.php41
-rw-r--r--tests/unit/http/TextDownloadResponseTest.php6
-rw-r--r--tests/unit/http/TextResponseTest.php3
-rw-r--r--tests/unit/service/FeedServiceTest.php (renamed from tests/unit/businesslayer/FeedBusinessLayerTest.php)126
-rw-r--r--tests/unit/service/FolderServiceTest.php (renamed from tests/unit/businesslayer/FolderBusinessLayerTest.php)70
-rw-r--r--tests/unit/service/ItemServiceTest.php (renamed from tests/unit/businesslayer/ItemBusinessLayerTest.php)74
-rw-r--r--tests/unit/service/ServiceTest.php (renamed from tests/unit/businesslayer/BusinessLayerTest.php)28
-rw-r--r--tests/unit/service/StatusFlagTest.php (renamed from tests/unit/businesslayer/StatusFlagTest.php)3
-rw-r--r--tests/unit/utility/ConfigTest.php22
-rw-r--r--tests/unit/utility/FaviconFetcherTest.php3
-rw-r--r--tests/unit/utility/OPMLExporterTest.php15
-rw-r--r--tests/unit/utility/UpdaterTest.php39
38 files changed, 1404 insertions, 2517 deletions
diff --git a/tests/unit/articleenhancer/EnhancerTest.php b/tests/unit/articleenhancer/EnhancerTest.php
index 5c54816a8..129b88fd7 100644
--- a/tests/unit/articleenhancer/EnhancerTest.php
+++ b/tests/unit/articleenhancer/EnhancerTest.php
@@ -15,8 +15,6 @@ namespace OCA\News\ArticleEnhancer;
use \OCA\News\Db\Item;
-require_once(__DIR__ . "/../../classloader.php");
-
class EnhancerTest extends \PHPUnit_Framework_TestCase {
@@ -37,14 +35,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..a08371f47 100644
--- a/tests/unit/articleenhancer/RegexArticleEnhancerTest.php
+++ b/tests/unit/articleenhancer/RegexArticleEnhancerTest.php
@@ -15,8 +15,6 @@ namespace OCA\News\ArticleEnhancer;
use \OCA\News\Db\Item;
-require_once(__DIR__ . "/../../classloader.php");
-
class RegexArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
@@ -25,7 +23,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..bc6b737ae 100644
--- a/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
+++ b/tests/unit/articleenhancer/XPathArticleEnhancerTest.php
@@ -15,8 +15,6 @@ namespace OCA\News\ArticleEnhancer;
use \OCA\News\Db\Item;
-require_once(__DIR__ . "/../../classloader.php");
-
class XPathArticleEnhancerTest extends \PHPUnit_Framework_TestCase {
@@ -57,12 +55,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 +71,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 +115,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 +163,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 +192,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 +221,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 +248,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 +270,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 +297,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 +324,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 +349,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/config/AppConfigTest.php b/tests/unit/config/AppConfigTest.php
index 8f91dd338..9053c6cbd 100644
--- a/tests/unit/config/AppConfigTest.php
+++ b/tests/unit/config/AppConfigTest.php
@@ -14,9 +14,6 @@
namespace OCA\News\Config;
-require_once(__DIR__ . '/../../classloader.php');
-
-
class AppConfigTest extends \PHPUnit_Framework_TestCase {
private $nav;
@@ -35,17 +32,11 @@ 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'
- );
+ $installedExtensions = ['curl' => '4.3'];
$databaseType = 'oracle';
$this->config = new AppConfig($this->nav, $this->l10n,
- $this->url, $phpVersion, $ownCloudVersion, $installedApps,
+ $this->url, $phpVersion, $ownCloudVersion,
$installedExtensions, $databaseType);
}
@@ -56,7 +47,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 +55,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 +83,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 +121,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 +134,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,28 +147,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();
- }
-
-
- /**
- * @expectedException \OCA\News\Config\DependencyException
- */
- public function testAppVersion() {
- $this->config->loadConfig(array(
- 'dependencies' => array(
- 'apps' =>
- array(
- 'contacts' => '5.3',
- 'calendar' => '>2.3'
- )
- )
- ));
+ ]
+ ]);
$this->config->testDependencies();
}
@@ -186,14 +160,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,43 +175,27 @@ 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();
}
- /**
- * @expectedException \OCA\News\Config\DependencyException
- */
- public function testAppsExistence() {
- $this->config->loadConfig(array(
- 'dependencies' => array(
- 'apps' =>
- array(
- 'news' => '>=4.3,<=4.3'
- )
- )
- ));
- $this->config->testDependencies();
- }
-
/**
* @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/ApiControllerTest.php b/tests/unit/controller/ApiControllerTest.php
deleted file mode 100644
index 26403830f..000000000
--- a/tests/unit/controller/ApiControllerTest.php
+++ /dev/null
@@ -1,132 +0,0 @@
-<?php
-/**
- * ownCloud - News
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
- */
-
-namespace OCA\News\Controller;
-
-use \OCP\IRequest;
-
-use \OCA\News\Utility\ControllerTestUtility;
-
-require_once(__DIR__ . "/../../classloader.php");
-
-
-class ApiControllerTest extends ControllerTestUtility {
-
- private $settings;
- private $request;
- private $newsAPI;
- private $updater;
- private $appName;
-
- protected function setUp() {
- $this->appName = 'news';
- $this->settings = $this->getMockBuilder(
- '\OCP\IConfig')
- ->disableOriginalConstructor()
- ->getMock();
- $this->request = $this->getMockBuilder(
- '\OCP\IRequest')
- ->disableOriginalConstructor()
- ->getMock();
- $this->updater = $this->getMockBuilder(
- '\OCA\News\Utility\Updater')
- ->disableOriginalConstructor()
- ->getMock();
- $this->newsAPI = new ApiController($this->appName, $this->request,
- $this->updater, $this->settings);
- }
-
-
- private function assertDefaultAnnotations($methodName){
- $annotations = array('NoAdminRequired', 'NoCSRFRequired', 'API');
- $this->assertAnnotations($this->newsAPI, $methodName, $annotations);
- }
-
- public function testVersionAnnotations(){
- $this->assertDefaultAnnotations('version');
- }
-
- public function testBeforeUpdateAnnotations(){
- $annotations = array('NoCSRFRequired');
- $this->assertAnnotations($this->newsAPI, 'beforeUpdate', $annotations);
- }
-
- public function testAfterUpdateAnnotations(){
- $annotations = array('NoCSRFRequired');
- $this->assertAnnotations($this->newsAPI, 'afterUpdate', $annotations);
- }
-
- public function testGetVersion(){
- $this->settings->expects($this->once())
- ->method('getAppValue')
- ->with($this->equalTo($this->appName),
- $this->equalTo('installed_version'))
- ->will($this->returnValue('1.0'));
-
- $response = $this->newsAPI->version();
- $data = $response->getData();
- $version = $data['version'];
-
- $this->assertEquals('1.0', $version);
- }
-
-
- public function testBeforeUpdate(){
- $this->updater->expects($this->once())
- ->method('beforeUpdate');
- $this->newsAPI->beforeUpdate();
- }
-
-
- public function testAfterUpdate(){
- $this->updater->expects($this->once())
- ->method('afterUpdate');
- $this->newsAPI->afterUpdate();
- }
-
-
- public function testCorsAnnotations(){
- $annotations = array('NoAdminRequired', 'NoCSRFRequired', 'PublicPage');
- $this->assertAnnotations($this->newsAPI, 'cors', $annotations);
- }
-
-
- public function testCors() {
- $this->request = $this->getRequest(array('server' => array()));
- $this->newsAPI = new ApiController($this->appName, $this->request,
- $this->updater, $this->settings);
- $response = $this->newsAPI->cors();
-
- $headers = $response->getHeaders();
-
- $this->assertEquals('*', $headers['Access-Control-Allow-Origin']);
- $this->assertEquals('PUT, POST, GET, DELETE', $headers['Access-Control-Allow-Methods']);
- $this->assertEquals('false', $headers['Access-Control-Allow-Credentials']);
- $this->assertEquals('Authorization, Content-Type', $headers['Access-Control-Allow-Headers']);
- $this->assertEquals('1728000', $headers['Access-Control-Max-Age']);
- }
-
-
- public function testCorsUsesOriginIfGiven() {
- $this->request = $this->getRequest(array('server' => array('HTTP_ORIGIN' => 'test')));
- $this->newsAPI = new ApiController($this->appName, $this->request,
- $this->updater, $this->settings);
- $response = $this->newsAPI->cors();
-
- $headers = $response->getHeaders();
-
- $this->assertEquals('test', $headers['Access-Control-Allow-Origin']);
- }
-
-
-}
diff --git a/tests/unit/controller/EntityApiSerializerTest.php b/tests/unit/controller/EntityApiSerializerTest.php
new file mode 100644
index 000000000..9e77421ce
--- /dev/null
+++ b/tests/unit/controller/EntityApiSerializerTest.php
@@ -0,0 +1,99 @@
+<?php
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Alessandro Cosentino 2012
+ * @copyright Bernhard Posselt 2012, 2014
+ */
+
+namespace OCA\News\Controller;
+
+
+use \OCP\AppFramework\Http\Response;
+
+use \OCA\News\Db\Item;
+
+
+class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase {
+
+
+ public function testSerializeSingle() {
+ $item = new Item();
+ $item->setUnread();
+
+ $serializer = new EntityApiSerializer('items');
+ $result = $serializer->serialize($item);
+
+ $this->assertTrue($result['items'][0]['unread']);
+ }
+
+
+ public function testSerializeMultiple() {
+ $item = new Item();
+ $item->setUnread();
+
+ $item2 = new Item();
+ $item2->setRead();
+
+ $serializer = new EntityApiSerializer('items');
+
+ $result = $serializer->serialize([$item, $item2]);
+
+ $this->assertTrue($result['items'][0]['unread']);
+ $this->assertFalse($result['items'][1]['unread']);
+ }
+
+
+ public function testResponseNoChange() {
+ $response = new Response();
+ $serializer = new EntityApiSerializer('items');
+
+ $result = $serializer->serialize($response);
+
+ $this->assertEquals($response, $result);
+ }
+
+
+ public function testCompleteArraysTransformed() {
+ $item = new Item();
+ $item->setUnread();
+
+ $item2 = new Item();
+ $item2->setRead();
+
+ $serializer = new EntityApiSerializer('items');
+
+ $in = [
+ 'items' => [$item, $item2],
+ 'test' => 1
+ ];
+
+ $result = $serializer->serialize($in);
+
+ $this->assertTrue($result['items'][0]['unread']);
+ $this->assertFalse($result['items'][1]['unread']);
+ $this->assertEquals(1, $result['test']);
+ }
+
+
+ public function noEntityNoChange() {
+ $serializer = new EntityApiSerializer('items');
+
+ $in = [
+ 'items' => ['hi', '2'],
+ 'test' => 1
+ ];
+
+ $result = $serializer->serialize($in);
+
+ $this->assertEquals('hi', $result['items'][0]);
+ $this->assertEquals('2', $result['items'][1]);
+ $this->assertEquals(1, $result['test']);
+ }
+
+} \ No newline at end of file
diff --git a/tests/unit/controller/ExportControllerTest.php b/tests/unit/controller/ExportControllerTest.php
index 820784d18..28d69c6f3 100644
--- a/tests/unit/controller/ExportControllerTest.php
+++ b/tests/unit/controller/ExportControllerTest.php
@@ -13,27 +13,23 @@
namespace OCA\News\Controller;
-use \OCP\IRequest;
use \OCP\AppFramework\Http;
use \OCA\News\Http\TextDownloadResponse;
-use \OCA\News\Utility\ControllerTestUtility;
use \OCA\News\Utility\OPMLExporter;
use \OCA\News\Db\Item;
use \OCA\News\Db\Feed;
-require_once(__DIR__ . "/../../classloader.php");
-
-class ExportControllerTest extends ControllerTestUtility {
+class ExportControllerTest extends \PHPUnit_Framework_TestCase {
private $appName;
private $request;
private $controller;
private $user;
- private $feedBusinessLayer;
- private $folderBusinessLayer;
- private $itemBusinessLayer;
+ private $feedService;
+ private $folderService;
+ private $itemService;
private $opmlExporter;
/**