Skip to content

Commit

Permalink
FilterCodes release 2.3.1 (2022-06-07)
Browse files Browse the repository at this point in the history
Fix-222: Fixed PHPUnit 9.5 compatibility.
  • Loading branch information
michael-milette committed Jun 7, 2022
1 parent f070b42 commit 1a0cc16
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 28 deletions.
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Change Log
All notable changes to this project will be documented in this file.

## [2.3.1] 2022-06-02
## [2.3.1] 2022-06-07
### Added
phpcs.xml.cont.dist file.
- phpcs.xml.cont.dist file.
### Updated
.gitignore file.
Fix-221: Resolved conflict between {mygroups} amd {ifingroup} tags when used at the same time.
- .gitignore file.
- Fix-221: Resolved conflict between {mygroups} amd {ifingroup} tags when used at the same time.
- Fix-222: Fixed PHPUnit v9.5 compatibility.

## [2.3.0] 2022-04-19
### Added
- New {ifhasarolename roleshortname}{/ifhasarolename} tags.
Expand Down
41 changes: 18 additions & 23 deletions tests/filter_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

global $CFG;
require_once($CFG->dirroot . '/filter/filtercodes/filter.php');
namespace filter_filtercodes;

/**
* Unit tests for FilterCodes filter.
Expand All @@ -37,38 +34,35 @@
* @copyright 2017-2022 TNG Consulting Inc. - www.tngconsulting.ca
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class filter_filtercodes_testcase extends advanced_testcase {
class filter_test extends \advanced_testcase {

/**
* @var filter_filtercode $filter Instance of filtercodes.
*/
protected $filter;

/**
* Setup the test framework
*
* @return void
* Tests setup
*/
protected function setUp() {
public function setUp() : void {
global $PAGE;
parent::setUp();

$this->resetAfterTest(true);
$this->filter = new filter_filtercodes(context_system::instance(), []);
$this->setAdminUser();

// Enable FilterCodes filter at top level.
filter_set_global_state('filtercodes', TEXTFILTER_ON);

$PAGE->set_url(new \moodle_url('/'));
}

/**
* Filter test.
*
* @return void
*/
public function test_filter_filtercodes() {
global $CFG, $USER, $DB, $PAGE, $SITE;

$PAGE->set_url(new moodle_url('/'));
public function test_filtercodes() {
global $CFG, $USER, $DB, $PAGE;

$this->setadminuser();
// Create a test course.
$course = $this->getDataGenerator()->create_course();
$context = context_course::instance($course->id);
filter_set_local_state('filtercodes', $context->id, TEXTFILTER_ON);
$context = \context_course::instance($course->id);

$tests = [
[
Expand Down Expand Up @@ -290,7 +284,8 @@ public function test_filter_filtercodes() {
];

foreach ($tests as $test) {
$this->assertEquals($test['after'], $this->filter->filter($test['before']));
$filtered = format_text($test['before'], FORMAT_HTML, array('context' => \context_system::instance()));
$this->assertEquals($test['after'], $filtered);
}
}
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

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

$plugin->version = 2022041902; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2022060700; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014051200; // Requires Moodle version 2.7 or later.
$plugin->component = 'filter_filtercodes'; // Full name of the plugin (used for diagnostics).
$plugin->release = '2.3.1';
Expand Down

0 comments on commit 1a0cc16

Please sign in to comment.