CICI
parent
25ed0c28a6
commit
566387bd11
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<phpunit bootstrap="tests/bootstrap.php">
|
||||||
|
<filter>
|
||||||
|
<whitelist>
|
||||||
|
<directory suffix=".php">controller</directory>
|
||||||
|
<!--directory suffix=".php">http</directory-->
|
||||||
|
<exclude>
|
||||||
|
<directory suffix=".php">appinfo</directory>
|
||||||
|
<directory suffix=".php">templates</directory>
|
||||||
|
</exclude>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
<testsuite name='unit'>
|
||||||
|
<directory suffix='.php'>tests/php</directory>
|
||||||
|
</testsuite>
|
||||||
|
</phpunit>
|
Binary file not shown.
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* GpxEdit
|
||||||
|
*
|
||||||
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
|
* later. See the COPYING file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
define('PHPUNIT_RUN', 1);
|
||||||
|
|
||||||
|
// ugly hack to fix issues with template code using static code
|
||||||
|
$_SERVER['REQUEST_URI'] = '/index.php/apps/gpxedit/';
|
||||||
|
$_SERVER['SCRIPT_NAME'] = '/index.php';
|
||||||
|
|
||||||
|
require_once __DIR__.'/../../../lib/base.php';
|
||||||
|
|
||||||
|
if (version_compare(implode('.', \OCP\Util::getVersion()), '8.2', '>=')) {
|
||||||
|
\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
|
||||||
|
\OC_App::loadApp('gpxedit');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!class_exists('PHPUnit_Framework_TestCase')) {
|
||||||
|
require_once('PHPUnit/Autoload.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
OC_Hook::clear();
|
Binary file not shown.
|
@ -0,0 +1,79 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
namespace OCA\GpxEdit\Controller;
|
||||||
|
|
||||||
|
use \OCA\GpxEdit\AppInfo\Application;
|
||||||
|
|
||||||
|
class PageControllerTest extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
|
private $appName;
|
||||||
|
private $request;
|
||||||
|
private $contacts;
|
||||||
|
|
||||||
|
private $container;
|
||||||
|
private $app;
|
||||||
|
|
||||||
|
private $controller;
|
||||||
|
|
||||||
|
public function setUp() {
|
||||||
|
$this->appName = 'gpxedit';
|
||||||
|
$this->request = $this->getMockBuilder('\OCP\IRequest')
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->getMock();
|
||||||
|
$this->contacts = $this->getMockBuilder('OCP\Contacts\IManager')
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->getMock();
|
||||||
|
|
||||||
|
$this->app = new Application();
|
||||||
|
$this->container = $this->app->getContainer();
|
||||||
|
$c = $this->container;
|
||||||
|
|
||||||
|
// CREATE DUMMY USERS
|
||||||
|
$c->getServer()->getUserManager()->createUser('test', 'T0T0T0');
|
||||||
|
$c->getServer()->getUserManager()->createUser('test2', 'T0T0T0');
|
||||||
|
|
||||||
|
$this->controller = new UtilsController(
|
||||||
|
$this->appName,
|
||||||
|
$this->request,
|
||||||
|
'test',
|
||||||
|
$c->query('ServerContainer')->getUserFolder($c->query('UserId')),
|
||||||
|
$c->query('ServerContainer')->getConfig(),
|
||||||
|
//$c->getServer()->getShareManager(),
|
||||||
|
$c->getServer()->getAppManager()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tearDown() {
|
||||||
|
$user = $this->container->getServer()->getUserManager()->get('test');
|
||||||
|
$user->delete();
|
||||||
|
$user = $this->container->getServer()->getUserManager()->get('test2');
|
||||||
|
$user->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSession() {
|
||||||
|
$resp = $this->controller->addTileServer('plop', 'http://plop.org', 'type',
|
||||||
|
'layers', 'version', 'tformat', '0.5', 'true',
|
||||||
|
'13', '16', 'attr');
|
||||||
|
|
||||||
|
$data = $resp->getData();
|
||||||
|
$done = $data['done'];
|
||||||
|
|
||||||
|
$this->assertEquals($done, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue