mirror of
https://github.com/nextcloud/passman.git
synced 2025-09-11 15:34:29 +08:00
Create tests for page controller
This commit is contained in:
parent
2c90899e63
commit
62aa51dfe9
3 changed files with 17 additions and 5 deletions
|
@ -52,7 +52,7 @@ before_script:
|
|||
- mkdir -p build
|
||||
- curl -sSL https://phar.phpunit.de/phpunit.phar -o build/phpunit.phar
|
||||
- npm install
|
||||
# - ./occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database $DB --database-pass=''
|
||||
|
||||
|
||||
|
||||
script:
|
||||
|
|
|
@ -47,7 +47,7 @@ class PageController extends Controller {
|
|||
* @NoCSRFRequired
|
||||
*/
|
||||
public function bookmarklet($url='',$title='') {
|
||||
$params = array('url' => $url, 'label' => $title);
|
||||
$params = array('url' => $url, 'title' => $title);
|
||||
return new TemplateResponse('passman', 'bookmarklet', $params);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ class PageController extends Controller {
|
|||
* @NoCSRFRequired
|
||||
* @PublicPage
|
||||
*/
|
||||
public function publicSharePage($shareKey) {
|
||||
public function publicSharePage() {
|
||||
return new TemplateResponse('passman', 'public_share');
|
||||
}
|
||||
|
||||
|
|
|
@ -29,12 +29,24 @@ class PageControllerTest extends PHPUnit_Framework_TestCase {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
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 testBookmarklet() {
|
||||
$result = $this->controller->bookmarklet('http://google.com', 'Google');
|
||||
print_r($result->getParams());
|
||||
$this->assertEquals(['url' => 'http://google.com', 'title' => 'Google'], $result->getParams());
|
||||
$this->assertEquals('bookmarklet', $result->getTemplateName());
|
||||
$this->assertTrue($result instanceof TemplateResponse);
|
||||
}
|
||||
|
||||
public function testPublicSharePage() {
|
||||
$result = $this->controller->publicSharePage();
|
||||
$this->assertEquals('public_share', $result->getTemplateName());
|
||||
$this->assertTrue($result instanceof TemplateResponse);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue