Skip to content

Commit

Permalink
travis com
Browse files Browse the repository at this point in the history
  • Loading branch information
ewallah committed Sep 30, 2020
1 parent 6e874a7 commit 68e28e8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.txt
Expand Up @@ -44,4 +44,4 @@ Done
5. Docking event removed


![travis](https://travis-ci.org/ewallah/moodle-format_masonry.svg?branch=master)
![travis](https://travis-ci.com/ewallah/moodle-format_masonry.svg?branch=master)
5 changes: 5 additions & 0 deletions phpunit.xml
Expand Up @@ -39,6 +39,11 @@
<directory suffix=".php">.</directory>
<exclude>
<directory suffix="_test.php">tests/</directory>
<directory suffix=".php">lang/en/</directory>
<directory suffix=".php">db/</directory>
<file>version.php</file>
<file>format.php</file>
<file>settings.php</file>
</exclude>
</whitelist>
</filter>
Expand Down
37 changes: 21 additions & 16 deletions tests/format_masonry_test.php
Expand Up @@ -24,18 +24,22 @@

defined('MOODLE_INTERNAL') || die();

global $CFG;
require_once($CFG->dirroot . '/course/format/masonry/renderer.php');

/**
* format_masonry related unit tests
*
* @package format_masonry
* @copyright 2017 Renaat Debleu (www.eWallah.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers format_masonry
*/
class format_masonry_testcase extends advanced_testcase {

/**
* Tests for format_masonry::get_section_name method with default section names.
* @covers \format_masonry
* @covers format_masonry
*/
public function test_get_section_name() {
global $DB;
Expand All @@ -52,7 +56,7 @@ public function test_get_section_name() {

/**
* Tests for format_masonry::get_section_name method with modified section names.
* @covers \format_masonry
* @covers format_masonry
*/
public function test_get_section_name_customised() {
global $DB;
Expand All @@ -78,7 +82,7 @@ public function test_get_section_name_customised() {

/**
* Tests for format_masonry::get_default_section_name.
* @covers \format_masonry
* @covers format_masonry
*/
public function test_get_default_section_name() {
global $DB;
Expand All @@ -100,10 +104,10 @@ public function test_get_default_section_name() {

/**
* Test web service updating section name
* @covers \format_masonry
* @covers format_masonry
*/
public function test_update_inplace_editable() {
global $CFG, $DB;
global $CFG, $DB, $USER;
require_once($CFG->dirroot . '/lib/external/externallib.php');

$this->resetAfterTest();
Expand All @@ -113,6 +117,7 @@ public function test_update_inplace_editable() {
$course = $generator->create_course(['numsections' => 2, 'format' => 'masonry'], ['createsections' => true]);
$modinfo = get_fast_modinfo($course);
$section = $modinfo->get_section_info(2);
$USER->editing = true;

try {
core_external::update_inplace_editable('format_masonry', 'sectionname', $section->id, 'New section name');
Expand All @@ -137,10 +142,10 @@ public function test_update_inplace_editable() {

/**
* Test callback updating section name
* @covers \format_masonry
* @covers format_masonry
*/
public function test_inplace_editable() {
global $DB, $PAGE;
global $DB, $PAGE, $USER;

$this->resetAfterTest();
$generator = $this->getDataGenerator();
Expand All @@ -149,6 +154,7 @@ public function test_inplace_editable() {
$teacherrole = $DB->get_record('role', ['shortname' => 'editingteacher']);
$generator->enrol_user($user->id, $course->id, $teacherrole->id);
$this->setUser($user);
$USER->editing = true;
$modinfo = get_fast_modinfo($course);
$section = $modinfo->get_section_info(2);

Expand All @@ -170,7 +176,7 @@ public function test_inplace_editable() {

/**
* Test get_default_course_enddate.
* @covers \format_masonry
* @covers format_masonry
*/
public function test_default_course_enddate() {
global $CFG, $DB;
Expand Down Expand Up @@ -210,12 +216,11 @@ public function test_default_course_enddate() {

/**
* Test renderer.
* @coversDefaultClass \format_masonry_renderer
* @covers format_masonry_renderer
*/
public function test_renderer() {
global $CFG, $PAGE, $USER;
global $PAGE, $USER;
$this->resetAfterTest(true);
require_once($CFG->dirroot . '/course/format/masonry/renderer.php');
$this->setAdminUser();
$generator = $this->getDataGenerator();
$course = $generator->create_course(['numsections' => 5, 'format' => 'masonry'], ['createsections' => true]);
Expand Down Expand Up @@ -280,7 +285,7 @@ public function test_renderer() {

/**
* Test upgrade.
* @covers \format_masonry
* @covers format_masonry
*/
public function test_upgrade() {
global $CFG;
Expand All @@ -296,7 +301,7 @@ public function test_upgrade() {

/**
* Test privacy.
* @coversDefaultClass \format_masonry\privacy\provider
* @covers format_masonry\privacy\provider
*/
public function test_privacy() {
$privacy = new \format_masonry\privacy\provider();
Expand All @@ -305,7 +310,7 @@ public function test_privacy() {

/**
* Test format.
* @covers \format_masonry
* @covers format_masonry
*/
public function test_format() {
global $CFG, $PAGE;
Expand All @@ -324,7 +329,7 @@ public function test_format() {

/**
* Test format editing.
* @coversDefaultClass \format_masonry
* @covers format_masonry
*/
public function test_format_editing() {
global $CFG, $PAGE, $USER;
Expand All @@ -346,7 +351,7 @@ public function test_format_editing() {

/**
* Test other.
* @covers \format_masonry
* @covers format_masonry
*/
public function test_other() {
$this->resetAfterTest(true);
Expand Down

0 comments on commit 68e28e8

Please sign in to comment.