-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathPageControllerTest.php
More file actions
35 lines (27 loc) · 916 Bytes
/
Copy pathPageControllerTest.php
File metadata and controls
35 lines (27 loc) · 916 Bytes
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
<?php
namespace OCA\TimeTracker\Tests\Unit\Controller;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserSession;
use OCA\TimeTracker\Controller\PageController;
use PHPUnit\Framework\TestCase;
class PageControllerTest extends TestCase {
private $controller;
private $userId = 'john';
public function setUp(): void {
$request = $this->createMock(IRequest::class);
$user = $this->createMock(IUser::class);
$user->method('getUID')->willReturn($this->userId);
$userSession = $this->createMock(IUserSession::class);
$userSession->method('getUser')->willReturn($user);
$this->controller = new PageController(
'timetracker', $request, $userSession
);
}
public function testIndex(): void {
$result = $this->controller->index();
$this->assertEquals('spa', $result->getTemplateName());
$this->assertInstanceOf(TemplateResponse::class, $result);
}
}