mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-11-30 23:37:16 +01:00
Initial release
This commit is contained in:
48
tests/unit/controller/PageControllerTest.php
Normal file
48
tests/unit/controller/PageControllerTest.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - quicknotes
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Matias De lellis <mati86dl@gmail.com>
|
||||
* @copyright Matias De lellis 2016
|
||||
*/
|
||||
|
||||
namespace OCA\QuickNotes\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(
|
||||
'quicknotes', $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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user