. * */ namespace OCA\GpxEdit\Controller; use \OCA\GpxEdit\AppInfo\Application; //class PageControllerTest extends \PHPUnit_Framework_TestCase { 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('testUser', 'T0T0T0'); $c->getServer()->getUserManager()->createUser('testUser2', 'T0T0T0'); $this->controller = new UtilsController( $this->appName, $this->request, 'testUser', $c->query('ServerContainer')->getUserFolder('testUser'), $c->query('ServerContainer')->getConfig(), $c->getServer()->getAppManager() ); } public function tearDown() { $user = $this->container->getServer()->getUserManager()->get('testUser'); $user->delete(); $user = $this->container->getServer()->getUserManager()->get('testUser2'); $user->delete(); } public function testSession() { $resp = $this->controller->addTileServer('superserver', 'http://plop.org', 'type', 'layers', 'version', 'tformat', '0.5', 'true', '13', '16', 'attr'); $data = $resp->getData(); $done = $data['done']; $this->assertEquals($done, 1); } }