Completed
Push — master ( e5c131...a98b26 )
by Raimund
20s queued 11s
created

PageControllerTest::testIndex()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Nextcloud - Tasks
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Hendrik Leppelsack <[email protected]>
9
 * @copyright Hendrik Leppelsack 2015
10
 */
11
12
namespace OCA\Tasks\Controller;
13
14
use OCP\AppFramework\Http\TemplateResponse;
15
use PHPUnit\Framework\TestCase as Base;
16
17
18
class PageControllerTest extends Base {
19
20
	private $controller;
21
22
	public function setUp(): void {
23
		$request = $this->getMockBuilder('OCP\IRequest')->getMock();
24
25
		$this->controller = new PageController(
26
			'tasks',
27
			$request
28
		);
29
	}
30
31
32
	public function testIndex() {
33
		$result = $this->controller->index();
34
35
		$this->assertEquals('main', $result->getTemplateName());
36
		$this->assertEquals('user', $result->getRenderAs());
37
		$this->assertTrue($result instanceof TemplateResponse);
0 ignored issues
show
Bug introduced by
The class OCP\AppFramework\Http\TemplateResponse does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
38
	}
39
}
40