Skip to content

Commit

Permalink
Travis.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Sep 1, 2020
1 parent d91339e commit 4c4e891
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
3 changes: 3 additions & 0 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@

/**
* The SynHi filter does not store any user data.
*
* @copyright © 2020-onwards G J Barnard.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/
class provider implements \core_privacy\local\metadata\null_provider {

Expand Down
31 changes: 23 additions & 8 deletions tests/filtersynhitoolbox_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@

/**
* Toolbox unit tests for the SynHi filter.
*
* @group filter_synhi
* @copyright © 2020-onwards G J Barnard.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/
class filter_synhi_toolbox_testcase extends advanced_testcase {

Expand Down Expand Up @@ -124,7 +127,9 @@ public function test_setting_highlight_example() {
$theexpectedoutput .= ' <html>'.PHP_EOL;
$theexpectedoutput .= ' <head>'.PHP_EOL;
$theexpectedoutput .= ' <title>Example</title>'.PHP_EOL;
$theexpectedoutput .= ' <link rel=\'stylesheet\' type=\'text/css\' href=\'https://www.example.com/moodle/filter/synhi/javascript/EnlighterJS_3_4_0/styles/enlighterjs.godzilla.min.css\'>'.PHP_EOL;
$theexpectedoutput .= ' <link rel=\'stylesheet\' type=\'text/css\' ';
$theexpectedoutput .= 'href=\'https://www.example.com/moodle/filter/synhi/javascript';
$theexpectedoutput .= '/EnlighterJS_3_4_0/styles/enlighterjs.godzilla.min.css\'>'.PHP_EOL;
$theexpectedoutput .= ' <style>'.PHP_EOL;
$theexpectedoutput .= ' body .syntaxhighlighter {'.PHP_EOL;
$theexpectedoutput .= ' overflow: visible !important;'.PHP_EOL;
Expand All @@ -145,21 +150,26 @@ public function test_setting_highlight_example() {
$theexpectedoutput .= ' }'.PHP_EOL;
$theexpectedoutput .= '}&lt;/pre&gt;'.PHP_EOL;
$theexpectedoutput .= ' </body>'.PHP_EOL;
$theexpectedoutput .= ' <script type=\'text/javascript\' charset=\'utf-8\' src=\'https://www.example.com/moodle/filter/synhi/javascript/EnlighterJS_3_4_0/scripts/enlighterjs.min.js\'></script>'.PHP_EOL;
$theexpectedoutput .= ' <script type=\'text/javascript\' charset=\'utf-8\'>EnlighterJS.init(\'pre\', \'code\', {theme: \'godzilla\', indent : 4});</script>'.PHP_EOL;
$theexpectedoutput .= ' <script type=\'text/javascript\' charset=\'utf-8\' ';
$theexpectedoutput .= 'src=\'https://www.example.com/moodle/filter/';
$theexpectedoutput .= 'synhi/javascript/EnlighterJS_3_4_0/scripts/enlighterjs.min.js\'></script>'.PHP_EOL;
$theexpectedoutput .= ' <script type=\'text/javascript\' charset=\'utf-8\'>';
$theexpectedoutput .= 'EnlighterJS.init(\'pre\', \'code\', {theme: \'godzilla\', indent : 4});</script>'.PHP_EOL;
$theexpectedoutput .= ' </html>'.PHP_EOL;
$theexpectedoutput .= '" onload="resize_setting_highlight_example_frame(this)"></iframe>'.PHP_EOL;
$theexpectedoutput .= '<script>'.PHP_EOL;
$theexpectedoutput .= ' function resize_setting_highlight_example_frame(obj) {'.PHP_EOL;
$theexpectedoutput .= ' obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + \'px\';'.PHP_EOL;
$theexpectedoutput .= ' obj.style.height = obj.contentWindow.document.';
$theexpectedoutput .= 'documentElement.scrollHeight + \'px\';'.PHP_EOL;
$theexpectedoutput .= ' }'.PHP_EOL;
$theexpectedoutput .= '</script>';
$this->assertEquals($theexpectedoutput, $thereturneddata);

$engine = 'valenta';
$style = 'class43';
$thereturneddata = $this->instance->setting_highlight_example($engine, $style);
$theexpectedoutput = '<p id="setting_highlight_example_frame">Invalid parameters passed to \'setting_highlight_example(\'valenta\', \'class43\')\'</p>';
$theexpectedoutput = '<p id="setting_highlight_example_frame">Invalid parameters passed to ';
$theexpectedoutput .= '\'setting_highlight_example(\'valenta\', \'class43\')\'</p>';
$this->assertEquals($theexpectedoutput, $thereturneddata);

$engine = 'syntaxhighlighter';
Expand All @@ -169,7 +179,9 @@ public function test_setting_highlight_example() {
$theexpectedoutput .= ' <html>'.PHP_EOL;
$theexpectedoutput .= ' <head>'.PHP_EOL;
$theexpectedoutput .= ' <title>Example</title>'.PHP_EOL;
$theexpectedoutput .= ' <link rel=\'stylesheet\' type=\'text/css\' href=\'https://www.example.com/moodle/filter/synhi/javascript/syntaxhighlighter_4_0_1/styles/fadetogrey.css\'>'.PHP_EOL;
$theexpectedoutput .= ' <link rel=\'stylesheet\' type=\'text/css\' href=';
$theexpectedoutput .= '\'https://www.example.com/moodle/filter/synhi';
$theexpectedoutput .= '/javascript/syntaxhighlighter_4_0_1/styles/fadetogrey.css\'>'.PHP_EOL;
$theexpectedoutput .= ' <style>'.PHP_EOL;
$theexpectedoutput .= ' body .syntaxhighlighter {'.PHP_EOL;
$theexpectedoutput .= ' overflow: visible !important;'.PHP_EOL;
Expand All @@ -190,12 +202,15 @@ public function test_setting_highlight_example() {
$theexpectedoutput .= ' }'.PHP_EOL;
$theexpectedoutput .= '}&lt;/pre&gt;'.PHP_EOL;
$theexpectedoutput .= ' </body>'.PHP_EOL;
$theexpectedoutput .= ' <script type=\'text/javascript\' charset=\'utf-8\' src=\'https://www.example.com/moodle/filter/synhi/javascript/syntaxhighlighter_4_0_1/scripts/syntaxhighlighter.js\'></script>'.PHP_EOL;
$theexpectedoutput .= ' <script type=\'text/javascript\' charset=\'utf-8\' src=';
$theexpectedoutput .= '\'https://www.example.com/moodle/filter/synhi/';
$theexpectedoutput .= 'javascript/syntaxhighlighter_4_0_1/scripts/syntaxhighlighter.js\'></script>'.PHP_EOL;
$theexpectedoutput .= ' </html>'.PHP_EOL;
$theexpectedoutput .= '" onload="resize_setting_highlight_example_frame(this)"></iframe>'.PHP_EOL;
$theexpectedoutput .= '<script>'.PHP_EOL;
$theexpectedoutput .= ' function resize_setting_highlight_example_frame(obj) {'.PHP_EOL;
$theexpectedoutput .= ' obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + \'px\';'.PHP_EOL;
$theexpectedoutput .= ' obj.style.height = obj.contentWindow.document.';
$theexpectedoutput .= 'documentElement.scrollHeight + \'px\';'.PHP_EOL;
$theexpectedoutput .= ' }'.PHP_EOL;
$theexpectedoutput .= '</script>';
$this->assertEquals($theexpectedoutput, $thereturneddata);
Expand Down
3 changes: 1 addition & 2 deletions tests/privacy_provider_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@

/**
* Privacy unit tests for the SynHi filter.
* @group filter_synhi
*
* @group filter_synhi
* @copyright &copy; 2020-onwards G J Barnard.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/
class filter_synhi_privacy_testcase extends \core_privacy\tests\provider_testcase {
Expand Down

0 comments on commit 4c4e891

Please sign in to comment.