Merge pull request #33 from NoelDeMartin/MOBILE-3876
MOBILE-3876 behat: Test that plugins work properlymain
commit
b181f774cc
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace local_moodlemobileapp\output;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
class mobile {
|
||||
|
||||
/**
|
||||
* Render index page.
|
||||
*
|
||||
* @return array View data.
|
||||
*/
|
||||
public static function view_index() {
|
||||
$templates = [
|
||||
[
|
||||
'id' => 'main',
|
||||
'html' => '<h1 class="text-center">Hello<span id="username"></span>!</h1>',
|
||||
],
|
||||
];
|
||||
|
||||
$javascript = file_get_contents(__DIR__ . '/../../js/mobile/index.js');
|
||||
|
||||
return compact('templates', 'javascript');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
$addons = [
|
||||
'local_moodlemobileapp' => [
|
||||
'handlers' => [
|
||||
'index' => [
|
||||
'delegate' => 'CoreMainMenuDelegate',
|
||||
'method' => 'view_index',
|
||||
'displaydata' => [
|
||||
'title' => 'pluginname',
|
||||
'icon' => 'language',
|
||||
],
|
||||
],
|
||||
],
|
||||
'lang' => [
|
||||
['pluginname', 'local_moodlemobileapp'],
|
||||
],
|
||||
],
|
||||
];
|
|
@ -0,0 +1,5 @@
|
|||
this.CoreSitesProvider.getSite().then(site => {
|
||||
const username = site.infos.username;
|
||||
|
||||
document.getElementById('username').innerText = `, ${username}`;
|
||||
});
|
|
@ -0,0 +1,16 @@
|
|||
@app @javascript
|
||||
Feature: Plugins work properly.
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username |
|
||||
| studentusername |
|
||||
|
||||
Scenario: See main menu button
|
||||
When I enter the app
|
||||
And I log in as "studentusername"
|
||||
And I press the main menu button in the app
|
||||
Then I should find "Moodle Mobile language strings" in the app
|
||||
|
||||
When I press "Moodle Mobile language strings" in the app
|
||||
Then I should find "studentusername" in the app
|
Loading…
Reference in New Issue