mirror of
https://github.com/nextcloud/passman.git
synced 2024-11-12 11:04:18 +08:00
48 lines
1 KiB
PHP
48 lines
1 KiB
PHP
|
<?php
|
||
|
/**
|
||
|
* Nextcloud - passman
|
||
|
*
|
||
|
* This file is licensed under the Affero General Public License version 3 or
|
||
|
* later. See the COPYING file.
|
||
|
*
|
||
|
* @author Sander Brand <brantje@gmail.com>
|
||
|
* @copyright Sander Brand 2016
|
||
|
*/
|
||
|
|
||
|
namespace OCA\Passman\Controller;
|
||
|
|
||
|
use PHPUnit_Framework_TestCase;
|
||
|
|
||
|
use OCP\AppFramework\Http\TemplateResponse;
|
||
|
|
||
|
|
||
|
class PageControllerTest extends PHPUnit_Framework_TestCase {
|
||
|
|
||
|
private $controller;
|
||
|
private $userId = 'john';
|
||
|
|
||
|
public function setUp() {
|
||
|
$request = $this->getMockBuilder('OCP\IRequest')->getMock();
|
||
|
|
||
|
$this->controller = new PageController(
|
||
|
'passman', $request, $this->userId
|
||
|
);
|
||
|
}
|
||
|
|
||
|
|
||
|
public function testIndex() {
|
||
|
$result = $this->controller->index();
|
||
|
|
||
|
$this->assertEquals(['user' => 'john'], $result->getParams());
|
||
|
$this->assertEquals('main', $result->getTemplateName());
|
||
|
$this->assertTrue($result instanceof TemplateResponse);
|
||
|
}
|
||
|
|
||
|
|
||
|
public function testEcho() {
|
||
|
$result = $this->controller->doEcho('hi');
|
||
|
$this->assertEquals(['echo' => 'hi'], $result->getData());
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|