2016-10-08 03:33:50 +08:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Nextcloud - passman
|
|
|
|
*
|
2016-10-19 23:44:19 +08:00
|
|
|
* @copyright Copyright (c) 2016, Sander Brand (brantje@gmail.com)
|
|
|
|
* @copyright Copyright (c) 2016, Marcos Zuriaga Miguel (wolfi@wolfi.es)
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 program. If not, see <http://www.gnu.org/licenses/>.
|
2016-10-08 03:33:50 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OCA\Passman\Controller;
|
|
|
|
|
|
|
|
use PHPUnit_Framework_TestCase;
|
|
|
|
|
2016-10-08 03:39:47 +08:00
|
|
|
use OCP\AppFramework\Http\JSONResponse;
|
2016-10-08 03:33:50 +08:00
|
|
|
|
2016-10-17 02:35:14 +08:00
|
|
|
/**
|
|
|
|
* Class InternalControllerTest
|
|
|
|
*
|
|
|
|
* @package OCA\Passman\Controller
|
|
|
|
* @coversDefaultClass \OCA\Passman\Controller\InternalController
|
|
|
|
*/
|
2016-10-08 03:33:50 +08:00
|
|
|
class InternalControllerTest extends PHPUnit_Framework_TestCase {
|
|
|
|
|
|
|
|
private $controller;
|
|
|
|
private $userId = 'john';
|
2016-10-08 03:39:47 +08:00
|
|
|
private $credentialService;
|
2016-10-08 03:33:50 +08:00
|
|
|
|
|
|
|
public function setUp() {
|
|
|
|
$request = $this->getMockBuilder('OCP\IRequest')->getMock();
|
2016-12-29 01:54:54 +08:00
|
|
|
$config = $this->getMockBuilder('OCP\IConfig')->getMock();
|
2016-10-08 03:39:47 +08:00
|
|
|
$this->credentialService = $this->getMockBuilder('OCA\Passman\Service\CredentialService')
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
|
|
|
$this->controller = new InternalController(
|
2016-12-29 01:54:54 +08:00
|
|
|
'passman', $request, $this->userId, $this->credentialService, $config
|
2016-10-08 03:33:50 +08:00
|
|
|
);
|
|
|
|
}
|
2016-10-08 03:39:47 +08:00
|
|
|
|
2017-01-04 18:55:32 +08:00
|
|
|
/**
|
|
|
|
* @covers ::remind
|
|
|
|
*/
|
|
|
|
public function testRemind() {
|
|
|
|
$this->controller->remind(null);
|
|
|
|
$this->assertTrue(true);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @covers ::read
|
|
|
|
*/
|
|
|
|
public function testRead() {
|
|
|
|
$this->controller->read(null);
|
|
|
|
$this->assertTrue(true);
|
|
|
|
}
|
|
|
|
|
2016-10-17 02:35:14 +08:00
|
|
|
/**
|
|
|
|
* @covers ::getAppVersion
|
|
|
|
*/
|
2016-10-08 03:33:50 +08:00
|
|
|
public function testGetAppVersion() {
|
|
|
|
$result = $this->controller->generatePerson();
|
|
|
|
$this->assertTrue($result instanceof JSONResponse);
|
|
|
|
}
|
2016-10-17 02:35:14 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers ::generatePerson
|
|
|
|
*/
|
2016-10-08 03:33:50 +08:00
|
|
|
public function testGeneratePerson() {
|
|
|
|
$result = $this->controller->generatePerson();
|
|
|
|
$this->assertTrue($result instanceof JSONResponse);
|
|
|
|
}
|
2017-01-04 18:55:32 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers ::getSettings
|
|
|
|
*/
|
|
|
|
public function testGetSettings() {
|
|
|
|
$result = $this->controller->getSettings();
|
|
|
|
$this->assertTrue($result instanceof JSONResponse);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers ::saveSettings
|
|
|
|
*/
|
|
|
|
public function testSaveSettings() {
|
|
|
|
$result = $this->controller->saveSettings('test', 'test');
|
|
|
|
$this->assertTrue(true);
|
|
|
|
}
|
|
|
|
|
2016-10-08 03:33:50 +08:00
|
|
|
}
|