blob: 548081da9768f8b0e7bb49585bc77563278f602d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?php
/**
* Nextcloud - contacts
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Hendrik Leppelsack <hendrik@leppelsack.de>
* @copyright Hendrik Leppelsack 2015
*/
namespace OCA\Contacts\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(
'contacts', $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());
}
}
|