first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+88
View File
@@ -0,0 +1,88 @@
<?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 core;
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_ALL)]
class attribute_helper_attribute_a {
public function __construct(
public readonly string $value,
) {
}
}
#[\Attribute]
class attribute_helper_attribute_b {
}
/**
* Helper for loading attributes.
*
* @package core
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
#[attribute_helper_attribute_a('a')]
#[attribute_helper_attribute_a('b')]
#[attribute_helper_attribute_b]
class attribute_helper_example {
#[attribute_helper_attribute_a('a')]
#[attribute_helper_attribute_a('b')]
#[attribute_helper_attribute_b]
public const WITH_ATTRIBUTES = 'examplevalue';
public const WITHOUT_ATTRIBUTE = 'examplevalue';
#[attribute_helper_attribute_a('a')]
#[attribute_helper_attribute_a('b')]
#[attribute_helper_attribute_b]
public string $withattributes = 'With attributes';
public string $withoutattributes = 'Without attributes';
#[attribute_helper_attribute_a('a')]
#[attribute_helper_attribute_a('b')]
#[attribute_helper_attribute_b]
public function with_attributes(): void {
}
public function without_attributes(): void {
}
}
class attribute_helper_example_without {
}
#[attribute_helper_attribute_a('a')]
#[attribute_helper_attribute_a('b')]
#[attribute_helper_attribute_b]
enum attribute_helper_enum: string {
#[attribute_helper_attribute_a('a')]
#[attribute_helper_attribute_a('b')]
#[attribute_helper_attribute_b]
case WITH_ATTRIBUTES = 'With attributes';
case WITHOUT_ATTRIBUTE = 'Without attributes';
}
#[attribute_helper_attribute_a('a')]
#[attribute_helper_attribute_a('b')]
#[attribute_helper_attribute_b]
function attribute_helper_method_with(): void {
}
function attribute_helper_method_without(): void {
}
+28
View File
@@ -0,0 +1,28 @@
<?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/>.
/**
* Test-specific subclass to make some protected things public.
*
* @package core
* @category test
* @copyright 2022 onwards Eloy Lafuente (stronk7) {@link https://stronk7.com}
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class block_ablocktype extends block_base {
public function init() {
}
}
@@ -0,0 +1,35 @@
<?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/>.
/**
* Example file declaring a class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace overlap\subnamespace;
/**
* Example Test Class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class example {
}
@@ -0,0 +1,33 @@
<?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/>.
/**
* Example file declaring a class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Example Test Class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class overlap_subnamespace_example2 {
}
+33
View File
@@ -0,0 +1,33 @@
<?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/>.
/**
* Example file declaring a class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Example Test Class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class psr0_main {
}
@@ -0,0 +1,33 @@
<?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/>.
/**
* Example file declaring a class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Example Test Class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class psr0_subnamespace_example {
}
@@ -0,0 +1,35 @@
<?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/>.
/**
* Example file declaring a class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace psr0\subnamespace;
/**
* Example Test Class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class slashes {
}
+35
View File
@@ -0,0 +1,35 @@
<?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/>.
/**
* Example file declaring a class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace PSR4;
/**
* Example Test Class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class main {
}
@@ -0,0 +1,35 @@
<?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/>.
/**
* Example file declaring a class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace psr4\subnamespace;
/**
* Example Test Class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class example {
}
@@ -0,0 +1,35 @@
<?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/>.
/**
* Example file declaring a class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace psr4\subnamespace;
/**
* Example Test Class
*
* @package core
* @copyright 2016 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class underscore_example {
}
+61
View File
@@ -0,0 +1,61 @@
<?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/>.
/**
* Fixtures for component_class_callback tests.
*
* @package core
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Class fixture for component_class_callback.
*
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class test_component_class_callback_example {
/**
* Function which returns the input value.
*
* @param mixed $output
* @return mixed
*/
public static function method_returns_value($output) {
return $output;
}
/**
* Function which returns all args.
*
* @return mixed
*/
public static function method_returns_all_params() {
return count(func_get_args());
}
}
/**
* Class fixture for component_class_callback which extends another class.
*
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class test_component_class_callback_child_example extends test_component_class_callback_example {
}
@@ -0,0 +1,39 @@
<?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 test_fixtures\core_renderer;
/**
* Hook fixture for \core_renderer::after_standard_main_region_html_generation.
*
* @package core
* @category test
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class after_standard_main_region_html_generation_callbacks {
/**
* Fixture for adding a heading after the standard main region HTML generation.
*
* @param \core\hook\output\after_standard_main_region_html_generation $hook
*/
public static function after_standard_main_region_html_generation(
\core\hook\output\after_standard_main_region_html_generation $hook,
): void {
$hook->add_html("<h1>A heading can be added</h1>");
}
}
@@ -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/>.
/**
* Hook fixture for \core_renderer::after_standard_main_region_html_generation.
*
* @package core
* @category test
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
'hook' => \core\hook\output\after_standard_main_region_html_generation::class,
'callback' => \test_fixtures\core_renderer\after_standard_main_region_html_generation_callbacks::class
. '::after_standard_main_region_html_generation',
],
];
@@ -0,0 +1,36 @@
<?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 test_fixtures\core_renderer;
/**
* Hook fixture for \core_renderer::footer.
*
* @package core
* @category test
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class before_footer_html_generation_callbacks {
/**
* Fixture for adding a heading before the footer HTML generation.
*
* @param \core\hook\output\before_footer_html_generation $hook
*/
public static function before_footer_html_generation(\core\hook\output\before_footer_html_generation $hook): void {
$hook->add_html("<h1>A heading can be added</h1>");
}
}
@@ -0,0 +1,36 @@
<?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/>.
/**
* Hook fixture for \core_renderer::standard_footer_html.
*
* @package core
* @category test
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
'hook' => \core\hook\output\before_footer_html_generation::class,
'callback' => [
\test_fixtures\core_renderer\before_footer_html_generation_callbacks::class,
'before_footer_html_generation',
],
],
];
@@ -0,0 +1,39 @@
<?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 test_fixtures\core_renderer;
/**
* Hook fixture for \core_renderer::standard_footer_html.
*
* @package core
* @category test
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class before_standard_footer_html_generation_callbacks {
/**
* Fixture for adding a heading before the standard footer HTML generation.
*
* @param \core\hook\output\before_standard_footer_html_generation $hook
*/
public static function before_standard_footer_html_generation(
\core\hook\output\before_standard_footer_html_generation $hook,
): void {
$hook->add_html("<h1>A heading can be added</h1>");
}
}
@@ -0,0 +1,36 @@
<?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/>.
/**
* Hook fixture for \core_renderer::standard_footer_html.
*
* @package core
* @category test
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
'hook' => \core\hook\output\before_standard_footer_html_generation::class,
'callback' => [
\test_fixtures\core_renderer\before_standard_footer_html_generation_callbacks::class,
'before_standard_footer_html_generation',
],
],
];
@@ -0,0 +1,38 @@
<?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 test_fixtures\core_renderer;
/**
* Hook fixture for \core_renderer::htmlattributes.
*
* @package core
* @category test
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class before_standard_top_of_body_html_generation_callbacks {
/**
* Fixture for adding a heading to the top of the body HTML.
*
* @param \core\hook\output\before_standard_top_of_body_html_generation $hook
*/
public static function before_standard_top_of_body_html_generation(
\core\hook\output\before_standard_top_of_body_html_generation $hook,
): void {
$hook->add_html("<h1>A heading can be added to the top of the body HTML</h1>");
}
}
@@ -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/>.
/**
* Hook fixture for before_standard_top_of_body_html_generation.
*
* @package core
* @category test
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
'hook' => \core\hook\output\before_standard_top_of_body_html_generation::class,
'callback' => \test_fixtures\core_renderer\before_standard_top_of_body_html_generation_callbacks::class
. '::before_standard_top_of_body_html_generation',
],
];
@@ -0,0 +1,36 @@
<?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 test_fixtures\core_renderer;
/**
* Hook fixture for \core_renderer::htmlattributes.
*
* @package core
* @category test
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class htmlattributes {
/**
* Fixture for adding a data attribute to the HTML element.
*
* @param \core\hook\output\before_html_attributes $hook
*/
public static function before_html_attributes(\core\hook\output\before_html_attributes $hook): void {
$hook->add_attribute('data-test', 'test');
}
}
@@ -0,0 +1,33 @@
<?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/>.
/**
* Hook fixture for \core_renderer::htmlattributes.
*
* @package core
* @category test
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
'hook' => \core\hook\output\before_html_attributes::class,
'callback' => \test_fixtures\core_renderer\htmlattributes::class . '::before_html_attributes',
],
];
+136
View File
@@ -0,0 +1,136 @@
<?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 core\fixtures;
use core\attribute\deprecated;
/**
* A file containing a variety of fixturs for deprecated attribute tests.
*
* @package core
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
#[deprecated('not_deprecated_class')]
class deprecated_class {
protected string $notdeprecatedproperty = 'Not deprecated property';
#[deprecated('$this->notdeprecatedproperty')]
protected string $deprecatedproperty = 'Deprecated property';
const NOT_DEPRECATED_CONST = 'Not deprecated const';
#[deprecated('not_deprecated_class::NEW_CONSTANT')]
const DEPRECATED_CONST = 'Deprecated const';
public function not_deprecated_method() {
}
#[deprecated(replacement: null, mdl: 'MDL-80677')]
public function deprecated_method() {
}
}
class not_deprecated_class {
protected string $notdeprecatedproperty = 'Not deprecated property';
#[deprecated('$this->notdeprecatedproperty')]
protected string $deprecatedproperty = 'Deprecated property';
const NOT_DEPRECATED_CONST = 'Not deprecated const';
#[deprecated('self::NOT_DEPRECATED_CONST')]
const DEPRECATED_CONST = 'Deprecated const';
public function not_deprecated_method() {
}
#[deprecated('$this->not_deprecated_method()')]
public function deprecated_method() {
}
}
function not_deprecated_function() {
}
#[deprecated('not_deprecated_class::not_deprecated_method()')]
function deprecated_function() {
}
interface not_deprecated_interface {
const NOT_DEPRECATED_CONST = 'Not deprecated const';
#[deprecated('self::NOT_DEPRECATED_CONST')]
const DEPRECATED_CONST = 'Deprecated const';
// Note: It does not make sense to deprecate methods in an _interface_ as the interface itself should be deprecated.
}
#[deprecated('not_deprecated_interface')]
interface deprecated_interface {
const DEPRECATED_CONST = 'Deprecated const';
public function not_deprecated_method();
}
trait not_deprecated_trait {
protected string $notdeprecatedproperty = 'Not deprecated property';
#[deprecated('$this->notdeprecatedproperty')]
protected string $deprecatedproperty = 'Deprecated property';
public function not_deprecated_method() {
}
#[deprecated('$this->not_deprecated_method()')]
public function deprecated_method() {
}
}
#[deprecated(not_deprecated_trait::class)]
trait deprecated_trait {
protected string $notdeprecatedproperty = 'Not deprecated property';
#[deprecated('$this->notdeprecatedproperty')]
protected string $deprecatedproperty = 'Deprecated property';
public function not_deprecated_method() {
}
#[deprecated(replacement: null, mdl: 'MDL-80677')]
public function deprecated_method() {
}
}
class not_deprecated_class_using_deprecated_trait_features {
use deprecated_trait;
}
class not_deprecated_class_implementing_deprecated_interface implements deprecated_interface {
public function not_deprecated_method() {
}
}
class not_deprecated_class_using_not_deprecated_trait_features {
use not_deprecated_trait;
}
class not_deprecated_class_implementing_not_deprecated_interface implements not_deprecated_interface {
public function not_deprecated_method() {
}
}
+1
View File
@@ -0,0 +1 @@
empty file for testing purposes
+311
View File
@@ -0,0 +1,311 @@
<?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 core_tests\event;
/**
* Fixtures for new event testing.
*
* @package core
* @category phpunit
* @copyright 2013 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
class unittest_executed extends \core\event\base {
public $nest = false;
public static function get_name() {
return 'xxx';
}
public function get_description() {
return 'yyy';
}
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
public function get_url() {
return new \moodle_url('/somepath/somefile.php', array('id'=>$this->data['other']['sample']));
}
}
class unittest_observer {
public static $info = array();
public static $event = array();
public static function reset() {
self::$info = array();
self::$event = array();
}
public static function observe_one(unittest_executed $event) {
self::$info[] = 'observe_one-'.$event->other['sample'];
self::$event[] = $event;
}
public static function external_observer(unittest_executed $event) {
self::$info[] = 'external_observer-'.$event->other['sample'];
self::$event[] = $event;
}
public static function broken_observer(unittest_executed $event) {
self::$info[] = 'broken_observer-'.$event->other['sample'];
self::$event[] = $event;
throw new \Exception('someerror');
}
public static function observe_all(\core\event\base $event) {
if (!($event instanceof unittest_executed)) {
self::$info[] = 'observe_all-unknown';
self::$event[] = $event;
return;
}
self::$event[] = $event;
if (!empty($event->nest)) {
self::$info[] = 'observe_all-nesting-'.$event->other['sample'];
unittest_executed::create(array('context'=>\context_system::instance(), 'other'=>array('sample'=>666, 'xx'=>666)))->trigger();
} else {
self::$info[] = 'observe_all-'.$event->other['sample'];
}
}
public static function observe_all_alt(\core\event\base $event) {
self::$info[] = 'observe_all_alt';
self::$event[] = $event;
}
public static function legacy_handler($data) {
self::$info[] = 'legacy_handler-'.$data[0];
self::$event[] = $data;
}
}
class bad_event1 extends \core\event\base {
protected function init() {
//$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
}
class bad_event2 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'u';
//$this->data['edulevel'] = 10;
}
}
class bad_event2b extends \core\event\base {
protected function init() {
$this->data['crud'] = 'u';
// Invalid level value.
$this->data['edulevel'] = -1;
}
}
class bad_event3 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
unset($this->data['courseid']);
}
}
class bad_event4 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['xxx'] = 1;
}
}
class bad_event5 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'x';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
}
class bad_event6 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'xxx_xxx_xx';
}
}
class bad_event7 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = null;
}
}
class bad_event8 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'user';
}
}
class problematic_event1 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
}
class problematic_event2 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->context = \context_system::instance();
}
}
class problematic_event3 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->context = \context_system::instance();
}
protected function validate_data() {
parent::validate_data();
if (empty($this->data['other'])) {
debugging('other is missing');
}
}
}
class deprecated_event1 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_TEACHING; // Tests edulevel hint.
$this->context = \context_system::instance();
}
}
class noname_event extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->context = \context_system::instance();
}
}
/**
* Class course_module_viewed.
*
* Wrapper for testing \core\event\course_module_viewed.
*/
class course_module_viewed extends \core\event\course_module_viewed {
protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'feedback';
}
}
/**
* Class course_module_viewed_noinit.
*
* Wrapper for testing \core\event\course_module_viewed.
*/
class course_module_viewed_noinit extends \core\event\course_module_viewed {
}
/**
* Event for testing core\event\grade_report_viewed.
*/
class grade_report_viewed extends \core\event\grade_report_viewed {
}
/**
* This is an explanation of the event.
* - I'm making a point here.
* - I have a second {@link something} point here.
* - whitespace is intentional to test it's removal.
*
*
* I have something else *Yeah* that.
*
*
*
* @package core
* @category phpunit
* @copyright 2014 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class full_docblock extends \core\event\base {
protected function init() {
}
}
/**
* We have only the description in the docblock
* and nothing else.
*/
class docblock_test2 extends \core\event\base {
protected function init() {
}
}
/**
* Calendar event created event.
*
* @property-read array $other {
* Extra information about the event.
*
* - int timestart: timestamp for event time start.
* - string name: Name of the event.
* - int repeatid: Id of the parent event if present, else 0.
* }
*
* @package core
* @since Moodle 2.7
* @copyright 2014 onwards Adrian Greeve
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class docblock_test3 extends \core\event\base {
protected function init() {
}
}
class static_info_viewing extends \core\event\base {
protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'mod_unittest';
}
}
+33
View File
@@ -0,0 +1,33 @@
<?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/>.
/**
* Fixtures for new event testing under namespace mod_tests.
*
* @package core
* @category phpunit
* @copyright 2013 onwards Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_unittests\event;
defined('MOODLE_INTERNAL') || die();
/**
* Class course_module_instances_list_viewed
*/
class course_module_instances_list_viewed extends \core\event\course_module_instances_list_viewed {
}
+33
View File
@@ -0,0 +1,33 @@
<?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/>.
/**
* Fixtures for new event testing under namespace mod_tests.
*
* @package core
* @category phpunit
* @copyright 2013 onwards Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_unittests\event;
defined('MOODLE_INTERNAL') || die();
/**
* Class course_module_instance_list_viewed
*/
class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed {
}
+50
View File
@@ -0,0 +1,50 @@
<?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/>.
/**
* Test event handler definition used only from unit tests.
*
* @package core
* @subpackage event
* @copyright 2007 onwards Martin Dougiamas (http://dougiamas.com)
* @author Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$handlers = array (
'test_instant' => array (
'handlerfile' => '/lib/tests/eventslib_test.php',
'handlerfunction' => 'eventslib_sample_function_handler',
'schedule' => 'instant',
'internal' => 1,
),
'test_cron' => array (
'handlerfile' => '/lib/tests/eventslib_test.php',
'handlerfunction' => array('eventslib_sample_handler_class', 'static_method'),
'schedule' => 'cron',
'internal' => 1,
),
'test_legacy' => array (
'handlerfile' => '/lib/tests/event_test.php',
'handlerfunction' => '\core_tests\event\unittest_observer::legacy_handler',
'schedule' => 'instant',
'internal' => 1,
),
);
+80
View File
@@ -0,0 +1,80 @@
<?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/>.
/**
* Fake component for testing
*
* @package core
* @copyright 2022 Laurent David <laurent.david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
// Fake capabilities.
$capabilities = [
'fake/access:fakecapability' => [
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG | RISK_DATALOSS,
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => [
'user' => CAP_ALLOW
]
],
'fake/access:existingcapability' => [
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG | RISK_DATALOSS,
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => [
'manager' => CAP_ALLOW
]
],
'fake/access:replacementnoinfo' => [
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG | RISK_DATALOSS,
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => [
'user' => CAP_ALLOW
]
],
'fake/access:replacementmissing' => [
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG | RISK_DATALOSS,
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => [
'user' => CAP_ALLOW
]
],
'fake/access:replacementwithwrongcapability' => [
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG | RISK_DATALOSS,
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => [
'user' => CAP_ALLOW
]
],
];
// Deprecated capabilities - MDL-55580.
$deprecatedcapabilities = [
'fake/access:fakecapability' => ['replacement' => '', 'message' => 'This capability should not be used anymore.'],
'fake/access:replacementmissing' => ['message' => 'This capability should not be used anymore.'],
'fake/access:replacementnoinfo' => [],
'fake/access:replacementwithwrongcapability' => ['replacement' => 'fake/access:nonexistingcapabilty',
'message' => 'This capability should not be used anymore.'],
'fake/access:replacementwithexisting' => ['replacement' => 'fake/access:existingcapability',
'message' => 'This capability should not be used anymore.'],
];
+29
View File
@@ -0,0 +1,29 @@
<?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/>.
/**
* Fake component for testing
*
* @package core
* @copyright 2022 Laurent David <laurent.david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2022050200;
$plugin->requires = 2022041200;
$plugin->component = 'fake_access';
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

+21
View File
@@ -0,0 +1,21 @@
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20141028T213000Z
DTEND:20141028T223000Z
DTSTAMP:20141028T211302Z
ORGANIZER;CN=John Smith:mailto:john.smith@example.com
UID:hjlv3v1lcerpi629s5gpfuijk0@google.com
CREATED:20141028T210927Z
DESCRIPTION:Lorem ipsum dolor sit amet\, consectetur adipisicing elit.
LAST-MODIFIED:20141028T211302Z
LOCATION:150 Willis St\, Te Aro\, Wellington 6011\, New Zealand
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Google calendar
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
+83
View File
@@ -0,0 +1,83 @@
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
namespace test_plugin;
/**
* Fixture for testing of hooks.
*
* @package core
* @author Petr Skoda
* @copyright 2022 Open LMS
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class callbacks {
/** @var string[] list of calls */
public static $calls = [];
/**
* Callback tester.
*
* @param \test_plugin\hook\hook $hook
* @return void
*/
public static function test1(\test_plugin\hook\hook $hook): void {
self::$calls[] = 'test1';
}
/**
* Callback tester.
*
* @param \test_plugin\hook\hook $hook
* @return void
*/
public static function test2(\test_plugin\hook\hook $hook): void {
self::$calls[] = 'test2';
}
/**
* Callback tester.
*
* @param \test_plugin\hook\stoppablehook $hook
* @return void
*/
public static function stop1(\test_plugin\hook\stoppablehook $hook): void {
self::$calls[] = 'stop1';
$hook->stop();
}
/**
* Callback tester.
*
* @param \test_plugin\hook\stoppablehook $hook
* @return void
*/
public static function stop2(\test_plugin\hook\stoppablehook $hook): void {
self::$calls[] = 'stop2';
$hook->stop();
}
/**
* Callback tester for exceptions.
*
* @param \test_plugin\hook\hook $hook
* @return void
*/
public static function exception(\test_plugin\hook\hook $hook): void {
self::$calls[] = 'exception';
throw new \Exception('grrr');
}
}
@@ -0,0 +1,44 @@
<?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 fake_hooktest;
/**
* Class callback container for fake_hooktest
*
* @package core
* @copyright 2024 onwards Catalyst IT EU {@link https://catalyst-eu.net}
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class callbacks {
/**
* Test callback that is not replaced by a hook.
*
* @return string
*/
public static function current_class_callback(): string {
return 'Called current class callback';
}
/**
* Test callback that is replaced by a hook.
*
* @return string
*/
public static function old_class_callback(): string {
return 'Called deprecated class callback';
}
}
@@ -0,0 +1,53 @@
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
namespace fake_hooktest\hook;
/**
* Fixture for testing of hooks.
*
* @package core
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
* @copyright 2024 Catalyst IT Europe Ltd.
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class hook_replacing_callback implements
\core\hook\described_hook,
\core\hook\deprecated_callback_replacement {
/**
* Hook description.
*/
public static function get_hook_description(): string {
return 'Test hook replacing a plugin callback function.';
}
/**
* Deprecation info.
*/
public static function get_deprecated_plugin_callbacks(): array {
return ['old_callback'];
}
/**
* List of tags that describe this hook.
*
* @return string[]
*/
public static function get_hook_tags(): array {
return ['test'];
}
}
@@ -0,0 +1,33 @@
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
namespace fake_hooktest\hook;
use core\attribute;
/**
* Fixture for testing of hooks.
*
* @package core
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
* @copyright 2024 Catalyst IT Europe Ltd.
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
#[attribute\label('Test hook replacing a class callback.')]
#[attribute\tags('test')]
#[attribute\hook\replaces_callbacks('callbacks::old_class_callback')]
final class hook_replacing_class_callback {
}
@@ -0,0 +1,44 @@
<?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 fake_hooktest;
/**
* Hook callbacks
*
* @package core
* @copyright 2024 onwards Catalyst IT EU {@link https://catalyst-eu.net}
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class hook_callbacks {
/**
* Test callback which replaces a plugin callback.
*
* @return string
*/
public function component_callback_replacement(): string {
return 'Called component callback replacement';
}
/**
* Test callback which replaced a plugin class callback.
*
* @return string
*/
public function component_class_callback_replacement(): string {
return 'Called component class callback replacement';
}
}
@@ -0,0 +1,41 @@
<?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 fake_hooktest;
/**
* Hook discovery for fake plugin.
*
* @package core
* @copyright 2024 onwards Catalyst IT EU {@link https://catalyst-eu.net}
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class hooks implements \core\hook\discovery_agent {
public static function discover_hooks(): array {
return [
'fake_hooktest\hook\hook_replacing_callback' => [
'class' => 'fake_hooktest\hook\hook_replacing_callback',
'description' => 'Hook replacing callback',
'tags' => ['test'],
],
'fake_hooktest\hook\hook_replacing_class_callback' => [
'class' => 'fake_hooktest\hook\hook_replacing_class_callback',
'description' => 'Hook replacing class callback',
'tags' => ['test'],
],
];
}
}
@@ -0,0 +1,37 @@
<?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/>.
/**
* Hook callback definitions for core
*
* @package core
* @copyright 2024 onwards Catalyst IT EU {@link https://catalyst-eu.net}
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
'hook' => 'fake_hooktest\hook\hook_replacing_callback',
'callback' => 'fake_hooktest\hook_callbacks::component_callback_replacement',
'priority' => 500,
],
[
'hook' => 'fake_hooktest\hook\hook_replacing_class_callback',
'callback' => 'fake_hooktest\hook_callbacks::component_class_callback_replacement',
'priority' => 600,
],
];
@@ -0,0 +1,27 @@
<?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/>.
/**
* Hook callback definitions for core
*
* @package core
* @copyright 2024 onwards Catalyst IT EU {@link https://catalyst-eu.net}
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
];
+41
View File
@@ -0,0 +1,41 @@
<?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/>.
/**
* Library functions for fake_hooktest
*
* @package core
* @copyright 2024 onwards Catalyst IT EU {@link https://catalyst-eu.net}
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Test callback that is not replaced by a hook.
*
* @return string
*/
function fake_hooktest_current_callback() {
return 'Called current callback';
}
/**
* Test callback that is replaced by a hook.
*
* @return string
*/
function fake_hooktest_old_callback() {
return 'Called deprecated callback';
}
@@ -0,0 +1,30 @@
<?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/>.
/**
* Fake plugin for testing hooks.
*
* @package core
* @copyright 2024 onwards Catalyst IT EU {@link https://catalyst-eu.net}
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2024012200;
$plugin->requires = 2024011900;
$plugin->component = 'fake_hooktest';
+53
View File
@@ -0,0 +1,53 @@
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
namespace test_plugin\hook;
/**
* Fixture for testing of hooks.
*
* @package core
* @author Petr Skoda
* @copyright 2022 Open LMS
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class hook implements
\core\hook\described_hook,
\core\hook\deprecated_callback_replacement {
/**
* Hook description.
*/
public static function get_hook_description(): string {
return 'Test hook 1.';
}
/**
* Deprecation info.
*/
public static function get_deprecated_plugin_callbacks(): array {
return ['oldcallback'];
}
/**
* List of tags that describe this hook.
*
* @return string[]
*/
public static function get_hook_tags(): array {
return ['test'];
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
/**
* Fixtures for hook testing.
*
* @package core
* @author Petr Skoda
* @copyright 2022 Open LMS
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
'callback' => 'test_plugin\\callbacks::test2',
'priority' => 100,
],
[
'hook' => 'test_plugin\\hook\\hook',
'priority' => 100,
],
[
'hook' => 'test_plugin\\hook\\hook',
'callback' => 'test_plugin\\callbackstest2',
'priority' => 100,
],
];
+34
View File
@@ -0,0 +1,34 @@
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
/**
* Fixtures for hook testing.
*
* @package core
* @author Petr Skoda
* @copyright 2022 Open LMS
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
'hook' => 'test_plugin\\hook\\hook',
'callback' => 'test_plugin\\callbacks::exception',
'priority' => 1000,
],
];
+34
View File
@@ -0,0 +1,34 @@
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
/**
* Fixtures for hook testing.
*
* @package core
* @author Petr Skoda
* @copyright 2022 Open LMS
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
'hook' => 'test_plugin\\hook\\hook',
'callback' => 'test_plugin\\callbacks::missing',
'priority' => 1000,
],
];
+34
View File
@@ -0,0 +1,34 @@
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
/**
* Fixtures for hook testing.
*
* @package core
* @author Petr Skoda
* @copyright 2022 Open LMS
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
'hook' => 'test_plugin\\hook\\stoppablehook',
'callback' => 'test_plugin\\callbacks::stop1',
'priority' => 400,
],
];
+33
View File
@@ -0,0 +1,33 @@
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
/**
* Fixtures for hook testing.
*
* @package core
* @author Petr Skoda
* @copyright 2022 Open LMS
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
'hook' => 'test_plugin\\hook\\hook',
'callback' => [\test_plugin\callbacks::class, 'test1'],
],
];
+34
View File
@@ -0,0 +1,34 @@
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
/**
* Fixtures for hook testing.
*
* @package core
* @author Petr Skoda
* @copyright 2022 Open LMS
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
'hook' => 'test_plugin\\hook\\stoppablehook',
'callback' => 'test_plugin\\callbacks::stop2',
'priority' => 200,
],
];
+34
View File
@@ -0,0 +1,34 @@
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
/**
* Fixtures for hook testing.
*
* @package core
* @author Petr Skoda
* @copyright 2022 Open LMS
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
'hook' => 'test_plugin\\hook\\hook',
'callback' => 'test_plugin\\callbacks::test2',
'priority' => 200,
],
];
+65
View File
@@ -0,0 +1,65 @@
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
namespace test_plugin\hook;
use Psr\EventDispatcher\StoppableEventInterface;
/**
* Fixture for testing of hooks.
*
* @package core
* @author Petr Skoda
* @copyright 2022 Open LMS
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class stoppablehook implements
StoppableEventInterface,
\core\hook\described_hook {
/** @var bool stoppable flag */
private $stopped = false;
/**
* Hook description.
*/
public static function get_hook_description(): string {
return 'Test hook 2.';
}
/**
* Stop other callbacks.
*/
public function stop(): void {
$this->stopped = true;
}
/**
* Indicates if callback propagation should stop.
*/
public function isPropagationStopped(): bool {
return $this->stopped;
}
/**
* List of tags that describe this hook.
*
* @return string[]
*/
public static function get_hook_tags(): array {
return ['test'];
}
}
+4
View File
@@ -0,0 +1,4 @@
<?php
$string['thislanguage'] = 'AA native name';
$string['thislanguageint'] = 'AA international name';
+4
View File
@@ -0,0 +1,4 @@
<?php
$string['thislanguage'] = 'Orphaned language with non-existing parent';
$string['parentlanguage'] = 'bbparent';
+4
View File
@@ -0,0 +1,4 @@
<?php
$string['thislanguage'] = 'My parent is orphaned language';
$string['parentlanguage'] = 'bb';
+4
View File
@@ -0,0 +1,4 @@
<?php
$string['thislanguage'] = 'Circular dependency A';
$string['parentlanguage'] = 'cdc';
+4
View File
@@ -0,0 +1,4 @@
<?php
$string['thislanguage'] = 'Circular dependency B';
$string['parentlanguage'] = 'cda';
+4
View File
@@ -0,0 +1,4 @@
<?php
$string['thislanguage'] = 'Circular dependency C';
$string['parentlanguage'] = 'cdb';
+4
View File
@@ -0,0 +1,4 @@
<?php
$string['thislanguage'] = 'Deutsch';
$string['parentlanguage'] = 'en';
+4
View File
@@ -0,0 +1,4 @@
<?php
$string['thislanguage'] = 'Deutsch - Du';
$string['parentlanguage'] = 'de';
+4
View File
@@ -0,0 +1,4 @@
<?php
$string['thislanguage'] = 'Deutsch - Kids';
$string['parentlanguage'] = 'de_du';
+4
View File
@@ -0,0 +1,4 @@
<?php
$string['thislanguage'] = 'Self dependency';
$string['parentlanguage'] = 'sd';
+227
View File
@@ -0,0 +1,227 @@
<?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/>.
/**
* Fixture for Behat test of the max_input_vars handling for large forms.
*
* @package core
* @copyright 2015 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require(__DIR__ . '/../../../config.php');
require_once($CFG->libdir . '/formslib.php');
// Behat test fixture only.
defined('BEHAT_SITE_RUNNING') || die('Only available on Behat test server');
/**
* Form for testing max_input_vars.
*
* @copyright 2015 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_max_input_vars_form extends moodleform {
/**
* Form definition.
*/
public function definition() {
global $CFG, $PAGE;
$mform =& $this->_form;
$mform->addElement('header', 'general', '');
$mform->addElement('hidden', 'type', $this->_customdata['type']);
$mform->setType('type', PARAM_ALPHA);
// This is similar to how the selects are created for the role tables,
// without using a Moodle form element.
$select = html_writer::select(array(13 => 'ArrayOpt13', 42 => 'ArrayOpt4', 666 => 'ArrayOpt666'),
'arraytest[]', array(13, 42), false, array('multiple' => 'multiple', 'size' => 10));
$mform->addElement('static', 'arraybit', $select);
switch ($this->_customdata['control']) {
case 'c' :
// Create a whole stack of checkboxes.
for ($i = 0; $i < $this->_customdata['fieldcount']; $i++) {
$mform->addElement('advcheckbox', 'test_c' . $i, 'Checkbox ' . $i);
}
break;
case 'a' :
// Create a very large array input type field.
$options = array();
$values = array();
for ($i = 0; $i < $this->_customdata['fieldcount']; $i++) {
$options[$i] = 'BigArray ' . $i;
if ($i !== 3) {
$values[] = $i;
}
}
$select = html_writer::select($options,
'test_a[]', $values, false, array('multiple' => 'multiple', 'size' => 50));
$mform->addElement('static', 'bigarraybit', $select);
break;
}
// For the sake of it, let's have a second array.
$select = html_writer::select(array(13 => 'Array2Opt13', 42 => 'Array2Opt4', 666 => 'Array2Opt666'),
'array2test[]', array(13, 42), false, array('multiple' => 'multiple', 'size' => 10));
$mform->addElement('static', 'array2bit', $select);
$mform->addElement('submit', 'submitbutton', 'Submit here!');
}
}
require_login();
$context = context_system::instance();
$type = optional_param('type', '', PARAM_ALPHA);
// Set up the page details.
$PAGE->set_url(new moodle_url('/lib/tests/fixtures/max_input_vars.php'));
$PAGE->set_context($context);
if ($type) {
// Make it work regardless of max_input_vars setting on server, within reason.
if ($type[1] === 's') {
// Small enough to definitely fit in the area.
$fieldcount = 10;
} else if ($type[1] === 'm') {
// Just under the limit (will go over for advancedcheckbox).
$fieldcount = (int)ini_get('max_input_vars') - 100;
} else if ($type[1] === 'e') {
// Exactly on the PHP limit, taking into account extra form fields
// and the double fields for checkboxes.
if ($type[0] === 'c') {
$fieldcount = (int)ini_get('max_input_vars') / 2 - 2;
} else {
$fieldcount = (int)ini_get('max_input_vars') - 11;
}
}
$mform = new core_max_input_vars_form('max_input_vars.php',
array('type' => $type, 'fieldcount' => $fieldcount, 'control' => $type[0]));
if ($type[0] === 'c') {
$data = array();
for ($i = 0; $i < $fieldcount; $i++) {
if ($i === 3) {
// Everything is set except number 3.
continue;
}
$data['test_c' . $i] = 1;
}
$mform->set_data($data);
}
}
echo $OUTPUT->header();
if ($type && ($result = $mform->get_data())) {
$testc = array();
$testa = array();
foreach ($_POST as $key => $value) {
$matches = array();
// Handle the 'bulk' ones separately so we can show success/fail rather
// than outputting a thousand items; also makes it possible to Behat-test
// without depending on specific value of max_input_vars.
if (preg_match('~^test_c([0-9]+)$~', $key, $matches)) {
$testc[(int)$matches[1]] = $value;
} else if ($key === 'test_a') {
$testa = $value;
} else {
// Other fields are output straight off.
if (is_array($value)) {
echo html_writer::div(s($key) . '=[' . s(implode(',', $value)) . ']');
} else {
echo html_writer::div(s($key) . '=' . s($value));
}
}
}
// Confirm that the bulk results are correct.
switch ($type[0]) {
case 'c' :
$success = true;
for ($i = 0; $i < $fieldcount; $i++) {
if (!array_key_exists($i, $testc)) {
$success = false;
break;
}
if ($testc[$i] != ($i == 3 ? 0 : 1)) {
$success = false;
break;
}
}
if (array_key_exists($fieldcount, $testc)) {
$success = false;
}
// Check using Moodle form and _param functions too.
$key = 'test_c' . ($fieldcount - 1);
if (empty($result->{$key})) {
$success = false;
}
if (optional_param($key, 0, PARAM_INT) !== 1) {
$success = false;
}
echo html_writer::div('Bulk checkbox success: ' . ($success ? 'true' : 'false'));
break;
case 'a' :
$success = true;
for ($i = 0; $i < $fieldcount; $i++) {
if ($i === 3) {
if (in_array($i, $testa)) {
$success = false;
break;
}
} else {
if (!in_array($i, $testa)) {
$success = false;
break;
}
}
}
if (in_array($fieldcount, $testa)) {
$success = false;
}
// Check using Moodle _param function. The form does not include these
// fields so it won't be in the form result.
$array = optional_param_array('test_a', array(), PARAM_INT);
if ($array != $testa) {
$success = false;
}
echo html_writer::div('Bulk array success: ' . ($success ? 'true' : 'false'));
break;
}
} else if ($type) {
$mform->display();
}
// Show links to each available type of test.
echo html_writer::start_tag('ul');
foreach (array('c' => 'Advanced checkboxes',
'a' => 'Select options') as $control => $controlname) {
foreach (array('s' => 'Small', 'm' => 'Below limit', 'e' => 'Exact PHP limit') as $size => $sizename) {
echo html_writer::tag('li', html_writer::link('max_input_vars.php?type=' .
$control . $size, $controlname . ' / ' . $sizename));
}
}
echo html_writer::end_tag('ul');
echo $OUTPUT->footer();
+4
View File
@@ -0,0 +1,4 @@
----CLIENT----
----EXPECTEDPLAIN----
----EXPECTEDHTML----
----FULLSOURCE----
+131
View File
@@ -0,0 +1,131 @@
----CLIENT----
OS: Ubuntu 14.04
Mail Client: Evolution
Client Version: 31.6.0
Date: 30/04/2015
----EXPECTEDPLAIN----
An ion meets his atom friend on the street and says he's lost an
electron. "Are you sure?" asks the atom. The ion replies, "I'm
positive."
----EXPECTEDHTML----
An ion meets his atom friend on the street and says he's lost an
electron. "Are you sure?" asks the atom. The ion replies, "I'm positive."
----FULLSOURCE----
Message-ID: <1430198383.10608.0.camel@jean>
Subject: Re: [DIVERTED t1@localhost] test: Re: test
From: ankit <ankit@localhost>
To: ankit+AAAAAAAAAAIAAAAAAAAADQAAAAAAAAA3xIUdg5K043cciDEJ@localhost
Date: Tue, 28 Apr 2015 10:49:43 +0530
In-Reply-To: <77abfbf3eea680a5bd9cd88d2ca74e602b2168c7684d404d5049289f49f30e0f@localhost>
References:
<cc33da86ad1b5b11e72155da74ca23c92e5e295c534f724162172905dee7a2fb@localhost>
<77abfbf3eea680a5bd9cd88d2ca74e602b2168c7684d404d5049289f49f30e0f@localhost>
Content-Type: multipart/alternative; boundary="=-HCcF2t8PQgHyHwzJsOEP"
X-Mailer: Evolution 3.10.4-0ubuntu2
Mime-Version: 1.0
X-Evolution-Identity: 1416821596.2740.0@jean
X-Evolution-Fcc: folder://local/Sent
X-Evolution-Transport: 1416821597.2740.10@jean
X-Evolution-Source-Folder: folder://1416821596.2740.2%40jean/INBOX
X-Evolution-Source-Message: 298
X-Evolution-Source-Flags: ANSWERED SEEN
X-Evolution-Format: text/html
X-Evolution-Source:
--=-HCcF2t8PQgHyHwzJsOEP
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
An ion meets his atom friend on the street and says he's lost an
electron. "Are you sure?" asks the atom. The ion replies, "I'm
positive."
On Tue, 2015-04-28 at 13:18 +0800, Admin User wrote:
> test » Forums » Forum » test
>
> Picture of Admin User
> Re: test
> by Admin User - Tuesday, 28 April
> 2015, 1:17 PM
>
> Tell me a joke
>
>
> Show parent | Reply
> See this post in context
>
> ______________________________________________________________________
>
> Unsubscribe from this discussion Unsubscribe from all forums Change
> your forum digest preferences
>
>
> You can reply to this forum post via email.
>
--=-HCcF2t8PQgHyHwzJsOEP
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/4.6.6">
</HEAD>
<BODY>
An ion meets his atom friend on the street and says he's lost an<BR>
electron. &quot;Are you sure?&quot; asks the atom. The ion replies, &quot;I'm positive.&quot;<BR>
On Tue, 2015-04-28 at 13:18 +0800, Admin User wrote:
<BLOCKQUOTE TYPE=CITE>
<A HREF="http://localhost/stable_master_forum/course/view.php?id=2">test</A> &#187; <A HREF="http://localhost/stable_master_forum/mod/forum/index.php?id=2">Forums</A> &#187; <A HREF="http://localhost/stable_master_forum/mod/forum/view.php?f=2">Forum</A> &#187; <A HREF="http://localhost/stable_master_forum/mod/forum/discuss.php?d=1">test</A>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<TABLE CELLSPACING="0" CELLPADDING="3">
<TR>
<TD WIDTH="35" VALIGN="top">
<A HREF="http://localhost/stable_master_forum/user/view.php?id=2&amp;course=2"><IMG SRC="http://localhost/stable_master_forum/theme/image.php?theme=clean&amp;component=core&amp;image=u%2Ff2&amp;svg=0" WIDTH="35" HEIGHT="35" ALIGN="bottom" ALT="Picture of Admin User"></A>
</TD>
<TD>
Re: test
by <A HREF="http://localhost/stable_master_forum/user/view.php?id=2&amp;course=2">Admin User</A> - Tuesday, 28 April 2015, 1:17 PM
</TD>
</TR>
<TR>
<TD VALIGN="top">
&nbsp;
</TD>
<TD>
Tell me a joke<BR>
<BR>
<BR>
<A HREF="http://localhost/stable_master_forum/mod/forum/discuss.php?d=1&amp;parent=1">Show parent</A> | <A HREF="http://localhost/stable_master_forum/mod/forum/post.php?reply=55">Reply</A>
<A HREF="http://localhost/stable_master_forum/mod/forum/discuss.php?d=1#p55">See this post in context</A>
</TD>
</TR>
</TABLE>
<HR ALIGN="center">
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<A HREF="http://localhost/stable_master_forum/mod/forum/subscribe.php?id=2&amp;d=1">Unsubscribe from this discussion</A>&nbsp;<A HREF="http://localhost/stable_master_forum/mod/forum/unsubscribeall.php">Unsubscribe from all forums</A>&nbsp;<A HREF="http://localhost/stable_master_forum/mod/forum/index.php?id=2">Change your forum digest preferences</A>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
You can reply to this forum post via email.<BR>
<BR>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>
--=-HCcF2t8PQgHyHwzJsOEP--
+148
View File
@@ -0,0 +1,148 @@
----CLIENT----
Gmail
----EXPECTEDPLAIN----
This is a test response
----EXPECTEDHTML----
This is a test response
----FULLSOURCE----
Delivered-To: nxtmorg+aaaaaaaaaaiaaaaaaaaaagaaaaaaaaahbfpyofgjbkpkwpeh@gmail.com
Received: by 10.202.174.212 with SMTP id x203csp2773063oie;
Wed, 8 Jul 2015 03:45:49 -0700 (PDT)
X-Received: by 10.194.2.161 with SMTP id 1mr17755340wjv.143.1436352348859;
Wed, 08 Jul 2015 03:45:48 -0700 (PDT)
Return-Path: <dan@moodle.com>
Received: from mail-wg0-x22d.google.com (mail-wg0-x22d.google.com. [2a00:1450:400c:c00::22d])
by mx.google.com with ESMTPS id hf10si1873428wib.2.2015.07.08.03.45.48
for <nxtmorg+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAhBfpyofgjbKpKWPeH@gmail.com>
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 08 Jul 2015 03:45:48 -0700 (PDT)
Received-SPF: pass (google.com: domain of dan@moodle.com designates 2a00:1450:400c:c00::22d as permitted sender) client-ip=2a00:1450:400c:c00::22d;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of dan@moodle.com designates 2a00:1450:400c:c00::22d as permitted sender) smtp.mail=dan@moodle.com;
dkim=pass header.i=@moodle.com;
dmarc=pass (p=QUARANTINE dis=NONE) header.from=moodle.com
Received: by mail-wg0-x22d.google.com with SMTP id x7so186242655wgj.2
for <nxtmorg+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAhBfpyofgjbKpKWPeH@gmail.com>; Wed, 08 Jul 2015 03:45:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=moodle.com; s=google;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:content-type;
bh=jBsUlzIsNVo/9X0XRyhQfQKdI8jqA6v/XM5yi08CpW4=;
b=oyncjzbEuLnDDSZ4v7AbfMV8rlNClygbSabhxlhdgiUsZEORCGL83ZmjMencwF/MLm
a20Eh1Tho/5gGU3ZsacTgV8phNAp0yBl59mzZUVF4wabIQBMbQQlyBJsqn7RbIRky+DA
FpneKKLreS29B0BMr+95VGSJ/XRohQZSjw7nY=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20130820;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:content-type;
bh=jBsUlzIsNVo/9X0XRyhQfQKdI8jqA6v/XM5yi08CpW4=;
b=GXbTXInSb7VhTCe7uIdixAgUNh0tusJkfgc606jk8ZD5xy89IjLcCDaKBY4wPT/xgH
KqELVFnwUsAJRBv0ZiflgzvUQ7SC2znVbkfQK8idswgc7p3iaWxXLT/m3HwVrnn0Aord
uRlEW1eBraBdOD/as24aCbzBGFPjFDkynfK0dIyCVmXN05p8QE09bYqkOVSh3lDxeZfX
AIDjlfC8DmvKZQN68Con86SyzQ6epzs2A3yrQ3oMYxG5yAHFqoXbmQPZLyjWMqx0uJ4L
lRnq7wSSLsSA8a9q8RBO8JltmZHa1AShqMkHghh/RISISXyriFezN71F7lt303fDJLvw
5Z9g==
X-Gm-Message-State: ALoCoQk4VlKEKkaqy6MLYzq2ZN82v3a64TLQZJo0b26DUbmmS8UDpT8tstQh2kodndsV2GgB/bpT
X-Received: by 10.180.102.74 with SMTP id fm10mr112402988wib.25.1436352348167;
Wed, 08 Jul 2015 03:45:48 -0700 (PDT)
MIME-Version: 1.0
References: <665442d32a4d85d3ac239d88a146ffdf9becf154c78bf8394bf3bfdbb4c312f6@dan.moodle.local>
<b287e7e4769857e7e31675e9b6141ca71b147210ce28f8a4eadd77aef458ddea@dan.moodle.local>
In-Reply-To: <b287e7e4769857e7e31675e9b6141ca71b147210ce28f8a4eadd77aef458ddea@dan.moodle.local>
From: Dan Poltawski <dan@moodle.com>
Date: Wed, 08 Jul 2015 10:45:38 +0000
Message-ID: <CAOieoNi=VqpcPjhQNwGsw4m-3ATr03CgkriQ4ivgeKQpQtjKqA@mail.gmail.com>
Subject: Re: Using Moodle Test: Re: A test
To: nxtmorg+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAhBfpyofgjbKpKWPeH@gmail.com
Content-Type: multipart/alternative; boundary=f46d0444812b7c332b051a5ad7d1
--f46d0444812b7c332b051a5ad7d1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
This is a test response
On Wed, Jul 8, 2015 at 11:45 AM Admin User <nxtmorg@gmail.com> wrote:
> Using Moodle Test <http://dan.moodle.local/sites/course/view.php?id=3D3>=
=C2=BB
> Forums <http://dan.moodle.local/sites/mod/forum/index.php?id=3D3> =C2=BB =
Discussion
> forum <http://dan.moodle.local/sites/mod/forum/view.php?f=3D5> =C2=BB A t=
est
> <http://dan.moodle.local/sites/mod/forum/discuss.php?d=3D24>
> [image: Picture of Admin User]
> <http://dan.moodle.local/sites/user/view.php?id=3D2&course=3D3>
> Re: A test
> by Admin User <http://dan.moodle.local/sites/user/view.php?id=3D2&course=
=3D3>
> - Wednesday, 8 July 2015, 11:45 am
>
>
> test 123
> Show parent
> <http://dan.moodle.local/sites/mod/forum/discuss.php?d=3D24&parent=3D27> =
|
> Reply <http://dan.moodle.local/sites/mod/forum/post.php?reply=3D33>
> See this post in context
> <http://dan.moodle.local/sites/mod/forum/discuss.php?d=3D24#p33>
> ------------------------------
> Unsubscribe from this forum
> <http://dan.moodle.local/sites/mod/forum/subscribe.php?id=3D5> Unsubscrib=
e
> from this discussion
> <http://dan.moodle.local/sites/mod/forum/subscribe.php?id=3D5&d=3D24> Uns=
ubscribe
> from all forums
> <http://dan.moodle.local/sites/mod/forum/unsubscribeall.php> Change your
> forum digest preferences
> <http://dan.moodle.local/sites/mod/forum/index.php?id=3D3>
>
> You can reply to this via email.
>
--f46d0444812b7c332b051a5ad7d1
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">This is a test response</div><br><div class=3D"gmail_quote=
"><div dir=3D"ltr">On Wed, Jul 8, 2015 at 11:45 AM Admin User &lt;<a href=
=3D"mailto:nxtmorg@gmail.com">nxtmorg@gmail.com</a>&gt; wrote:<br></div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #=
ccc solid;padding-left:1ex">
<div>
<div><a href=3D"http://dan.moodle.local/sites/course/view.php?id=3D3" targe=
t=3D"_blank">Using Moodle Test</a> =C2=BB <a href=3D"http://dan.moodle.loca=
l/sites/mod/forum/index.php?id=3D3" target=3D"_blank">Forums</a> =C2=BB <a =
href=3D"http://dan.moodle.local/sites/mod/forum/view.php?f=3D5" target=3D"_=
blank">Discussion forum</a> =C2=BB <a href=3D"http://dan.moodle.local/sites=
/mod/forum/discuss.php?d=3D24" target=3D"_blank">A test</a></div><table bor=
der=3D"0" cellpadding=3D"3" cellspacing=3D"0"><tr><td width=3D"35" valign=
=3D"top"><a href=3D"http://dan.moodle.local/sites/user/view.php?id=3D2&amp;=
course=3D3" target=3D"_blank"><img src=3D"http://dan.moodle.local/sites/the=
me/image.php?theme=3Dmoodleorgcleaned_moodleorg&amp;component=3Dcore&amp;im=
age=3Du%2Ff2&amp;svg=3D0" alt=3D"Picture of Admin User" title=3D"Picture of=
Admin User" width=3D"35" height=3D"35"></a></td><td><div>Re: A test</div><=
div>by <a href=3D"http://dan.moodle.local/sites/user/view.php?id=3D2&amp;co=
urse=3D3" target=3D"_blank">Admin User</a> - Wednesday, 8 July 2015, 11:45 =
am</div></td></tr><tr><td valign=3D"top">=C2=A0</td><td><p>test 123</p><div=
><a href=3D"http://dan.moodle.local/sites/mod/forum/discuss.php?d=3D24&amp;=
parent=3D27" target=3D"_blank">Show parent</a> | <a href=3D"http://dan.mood=
le.local/sites/mod/forum/post.php?reply=3D33" target=3D"_blank">Reply</a></=
div><div><a href=3D"http://dan.moodle.local/sites/mod/forum/discuss.php?d=
=3D24#p33" target=3D"_blank">See this post in context</a></div></td></tr></=
table>
<hr><div><a href=3D"http://dan.moodle.local/sites/mod/forum/subscribe.php?i=
d=3D5" target=3D"_blank">Unsubscribe from this forum</a>=C2=A0<a href=3D"ht=
tp://dan.moodle.local/sites/mod/forum/subscribe.php?id=3D5&amp;d=3D24" targ=
et=3D"_blank">Unsubscribe from this discussion</a>=C2=A0<a href=3D"http://d=
an.moodle.local/sites/mod/forum/unsubscribeall.php" target=3D"_blank">Unsub=
scribe from all forums</a>=C2=A0<a href=3D"http://dan.moodle.local/sites/mo=
d/forum/index.php?id=3D3" target=3D"_blank">Change your forum digest prefer=
ences</a></div></div><p>You can reply to this via email.</p>
</blockquote></div>
--f46d0444812b7c332b051a5ad7d1--
+338
View File
@@ -0,0 +1,338 @@
----CLIENT----
OS: ios 8.1.1
Mail Client: ios (iPad Mini Retina)
Client Version: 8.1.1
Date: 04/05/2015
----EXPECTEDPLAIN----
Sample reply messages:
Thanks for offering to help with QA testing. I've added you to the testers group in the tracker, so you can now pass or fail QA tests. Hopefully the process is fully explained in https://moodledev.io/general/development/process/testing/qa but if there's anything you're not sure about, please post in the testing and QA forum.
Thanks for offering to help with QA testing. Please create an account in the Moodle Tracker and let me know your Tracker username then I can add you to the testers group.
Thanks for offering to help with QA testing. We recently finished the Moodle 2.8 QA cycle, so our next QA cycle won't be for a while, however you are welcome to try things out on our Moodle QA Testing site http://qa.moodle.net/ and post in the Testing and QA forum http://moodle.org/mod/forum/view.php?id=56 about any issues you come across, or any questions you have. If you come across any bugs (obvious problems), please report them in the Moodle tracker.
Thanks for helping with QA testing. Your help would be appreciated even more if you could just add a comment when passing a test, such as feedback about the feature e.g. “Teachers are going to love this” or even simply "This test passes - yippee!" to confirm that the test wasn't accidentally passed without being run.
Thanks for helping with QA testing. It has been observed that you assigned this issue to yourself for testing, but no action has been taken on this. It will be helpful if you can either test this or un-assign yourself, so someone else can take it.
----EXPECTEDHTML----
 
Sample reply messages:
Thanks for offering to help with QA testing. I've added you to the testers
group in the tracker, so you can now pass or fail QA tests. Hopefully the
process is fully explained in
https://moodledev.io/general/development/process/testing/qa [10] but if
there's anything you're not sure about, please post in the testing and QA
forum.
Thanks for offering to help with QA testing. Please create an account in
the Moodle Tracker and let me know your Tracker username then I can add you
to the testers group.
Thanks for offering to help with QA testing. We recently finished the
Moodle 2.8 QA cycle, so our next QA cycle won't be for a while, however you
are welcome to try things out on our Moodle QA Testing site
http://qa.moodle.net/ [11] and post in the Testing and QA forum
http://moodle.org/mod/forum/view.php?id=56 [12] about any issues you come
across, or any questions you have. If you come across any bugs (obvious
problems), please report them in the Moodle tracker.
Thanks for helping with QA testing. Your help would be appreciated even
more if you could just add a comment when passing a test, such as feedback
about the feature e.g. “Teachers are going to love this” or even simply
"This test passes - yippee!" to confirm that the test wasn't accidentally
passed without being run.
Thanks for helping with QA testing. It has been observed that you assigned
this issue to yourself for testing, but no action has been taken on this.
 It will be helpful if you can either test this or un-assign yourself, so
someone else can take it.
Sent from my iPad
----FULLSOURCE----
Delivered-To: moodlehqtest+aaaaaaaaaaiaaaaaaaaaagaaaaaaaaayvgt8xe92mmlgeicg@example.com
Received: by 10.50.159.130 with SMTP id xc2csp1451249igb;
Sun, 3 May 2015 20:02:36 -0700 (PDT)
X-Received: by 10.67.4.230 with SMTP id ch6mr38162348pad.137.1430708556295;
Sun, 03 May 2015 20:02:36 -0700 (PDT)
Return-Path: <andrewrn@example.com>
Received: from mail-pa0-x229.google.com (mail-pa0-x229.google.com. [2607:f8b0:400e:c03::229])
by mx.google.com with ESMTPS id gl6si17965581pac.197.2015.05.03.20.02.35
for <moodlehqtest+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAYvGT8Xe92mmlGEicg@example.com>
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Sun, 03 May 2015 20:02:36 -0700 (PDT)
Received-SPF: pass (google.com: domain of andrewrn@example.com designates 2607:f8b0:400e:c03::229 as permitted sender) client-ip=2607:f8b0:400e:c03::229;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of andrewrn@example.com designates 2607:f8b0:400e:c03::229 as permitted sender) smtp.mail=andrewrn@example.com;
dkim=pass header.i=@example.com;
dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
Received: by mail-pa0-x229.google.com with SMTP id yx8so148925642pac.1
for <moodlehqtest+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAYvGT8Xe92mmlGEicg@example.com>; Sun, 03 May 2015 20:02:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=from:content-type:content-transfer-encoding:mime-version:subject
:message-id:date:references:in-reply-to:to;
bh=EZm73X2O6OdzfLc1nsBxWhkpKHmDJNt33U63cRjQHAw=;
b=IX/H6XP5WADMopMjPPQXpvr1Wm9TV67Ru+lWfBKXx8FstY2qSAf4g7P+EtCNBgWnac
qNm6cTY+x3kx/ZPQLfpaQD4+QrEHteu8T4pilbjN0ikpu8K1lRMGXRqDjLf49yNJaXpP
J4kMoye4i+3LA6ffGGer/5gax/s/gZ2M6nD8OCTuCxIVu51etROhDdo5OfsUK5w97R6P
33bMm6wfzd/OjLrNNaFZydGEHK4qQUgwn7GcYi1cAq7g9SLl1lWT6n65IrhMkaqroDnV
rBYzYdYKhJs2e16r0TBoKh0u+YHtZM9wF/3odFevDPxSnL56+lKUPpTkmuADNEQ+fJw9
zrMw==
X-Received: by 10.70.140.108 with SMTP id rf12mr38069446pdb.140.1430708555833;
Sun, 03 May 2015 20:02:35 -0700 (PDT)
Return-Path: <andrewrn@example.com>
Received: from [172.20.255.99] (59-100-142-46.cust.static-ipl.aapt.com.au. [59.100.142.46])
by mx.google.com with ESMTPSA id yv6sm2329352pac.29.2015.05.03.20.02.34
for <moodlehqtest+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAYvGT8Xe92mmlGEicg@example.com>
(version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
Sun, 03 May 2015 20:02:34 -0700 (PDT)
From: Andrew Robert Nicols <andrewrn@example.com>
Content-Type: multipart/alternative;
boundary=Apple-Mail-97963C5D-72E2-413A-89FF-624233E4337F
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (1.0)
Subject: Re: MDL-48002: Testing of MDL-48002
Message-Id: <ECE56778-577F-4B37-A28B-7789A19BBF3A@example.com>
Date: Mon, 4 May 2015 11:02:31 +0800
References: <15b35e982364f0003cea36e7a0464787ee6127fe5c21a54d229021314547699c@banana.per.in.moodle.com>
In-Reply-To: <15b35e982364f0003cea36e7a0464787ee6127fe5c21a54d229021314547699c@banana.per.in.moodle.com>
To: "moodlehqtest+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAYvGT8Xe92mmlGEicg@example.com" <moodlehqtest+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAYvGT8Xe92mmlGEicg@example.com>
X-Mailer: iPad Mail (12B435)
--Apple-Mail-97963C5D-72E2-413A-89FF-624233E4337F
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
=09
Sample reply messages:
Thanks for offering to help with QA testing. I've added you to the testers g=
roup in the tracker, so you can now pass or fail QA tests. Hopefully the pro=
cess is fully explained in https://moodledev.io/general/development/process/testing/qa but if ther=
e's anything you're not sure about, please post in the testing and QA forum.=
Thanks for offering to help with QA testing. Please create an account in the=
Moodle Tracker and let me know your Tracker username then I can add you to t=
he testers group.
Thanks for offering to help with QA testing. We recently finished the Moodle=
2.8 QA cycle, so our next QA cycle won't be for a while, however you are we=
lcome to try things out on our Moodle QA Testing site http://qa.moodle.net/ a=
nd post in the Testing and QA forum http://moodle.org/mod/forum/view.php?id=3D=
56 about any issues you come across, or any questions you have. If you come a=
cross any bugs (obvious problems), please report them in the Moodle tracker.=
Thanks for helping with QA testing. Your help would be appreciated even more=
if you could just add a comment when passing a test, such as feedback about=
the feature e.g. =E2=80=9CTeachers are going to love this=E2=80=9D or even s=
imply "This test passes - yippee!" to confirm that the test wasn't accidenta=
lly passed without being run.
Thanks for helping with QA testing. It has been observed that you assigned t=
his issue to yourself for testing, but no action has been taken on this. It=
will be helpful if you can either test this or un-assign yourself, so someo=
ne else can take it.
Sent from my iPad
> On 4 May 2015, at 11:02 am, Admin User <andrew@nicols.co.uk> wrote:
>=20
> MDL-48002 =C2=BB Forums =C2=BB MDL-48002 =C2=BB Testing of MDL-48002
> =09
> Testing of MDL-48002
> by Admin User - Monday, 4 May 2015, 10:48 AM
> =09
> We are trying to test that this issue will work as expected.
>=20
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis convallis ph=
aretra justo dignissim cursus. Sed sagittis, velit vel scelerisque sollicitu=
din, neque purus pulvinar nisi, quis semper urna dolor nec est. Maecenas ut d=
ui accumsan, tincidunt sem ac, efficitur lorem. Vivamus consequat viverra er=
os eget cursus. Morbi porttitor nunc vehicula consequat laoreet. Pellentesqu=
e ac diam vel libero finibus sodales a fringilla erat. Ut elementum ante ege=
t convallis dignissim. Proin iaculis mauris nec diam maximus, ac scelerisque=
metus tincidunt. Nullam tincidunt turpis ut aliquam volutpat. Vestibulum an=
te ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; D=
onec neque quam, sollicitudin bibendum ipsum id, malesuada convallis orci.
>=20
> Cras posuere, velit et consectetur euismod, orci ante malesuada libero, eu=
tincidunt tortor elit vitae tellus. Nunc vel felis id metus fringilla lobor=
tis. Sed sit amet ipsum vitae dolor aliquet dapibus eu vel nulla. Sed id dui=
nec nisl hendrerit blandit ut et turpis. Donec dictum nunc mauris, quis pla=
cerat tellus fermentum ac. Phasellus at fermentum quam. Phasellus magna magn=
a, pharetra pharetra pellentesque a, convallis non leo. Nunc ac semper est. U=
t interdum condimentum nunc sit amet sollicitudin. Aenean vitae sodales dolo=
r, vitae porta felis. Aliquam tincidunt posuere lorem sed mollis. Vestibulum=
sed quam convallis, commodo ante et, rhoncus metus. Sed arcu diam, venenati=
s vel urna eu, porta viverra massa. Suspendisse nec consectetur risus, quis h=
endrerit arcu. Ut purus metus, varius sit amet mauris non, posuere ultricies=
velit. Nullam nec luctus lorem.
>=20
> Proin quis turpis efficitur, auctor dui nec, vulputate ligula. Sed egestas=
facilisis magna nec posuere. Nam nisl nibh, dictum in velit eget, dapibus e=
uismod lacus. Phasellus mollis eros nibh, eu venenatis libero luctus eu. Eti=
am ultricies turpis interdum, rutrum leo sed, sollicitudin lectus. Suspendis=
se potenti. Vestibulum in purus orci. Pellentesque fringilla nunc ac diam tr=
istique pellentesque. Duis tincidunt mi ipsum, ac consequat augue iaculis a.=
Ut ut erat at lacus lobortis facilisis at at ipsum. Aliquam ut nisi posuere=
, dictum arcu id, placerat nisl. Vivamus in ex et lorem tempor iaculis eleme=
ntum quis nunc.
>=20
> Some more text here.
>=20
> Now in the reply we will not remove the content and sent a bit of a reply.=
>=20
> Reply
> See this post in context
> Unsubscribe from this discussion Unsubscribe from all forums Change your f=
orum digest preferences
> You can reply to this via email.
--Apple-Mail-97963C5D-72E2-413A-89FF-624233E4337F
Content-Type: text/html;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=3D=
utf-8"></head><body dir=3D"auto"><div><table border=3D"0" cellpadding=3D"3" c=
ellspacing=3D"0" class=3D"forumpost" style=3D"-webkit-text-size-adjust: auto=
;"><tbody><tr><td class=3D"left side" valign=3D"top"><span style=3D"-webkit-=
text-size-adjust: none; background-color: rgba(255, 255, 255, 0);">&nbsp;</s=
pan></td><td class=3D"content"><p></p><p dir=3D"ltr" style=3D"margin-top: 0p=
t; margin-bottom: 0pt;"><span style=3D"vertical-align: baseline; -webkit-tex=
t-size-adjust: none; background-color: rgba(255, 255, 255, 0);">Sample reply=
messages:</span></p><span style=3D"-webkit-text-size-adjust: none; backgrou=
nd-color: rgba(255, 255, 255, 0);"><br></span><p dir=3D"ltr" style=3D"margin=
-top: 0pt; margin-bottom: 0pt;"><span style=3D"font-style: italic; vertical-=
align: baseline; -webkit-text-size-adjust: none; background-color: rgba(255,=
255, 255, 0);">Thanks for offering to help with QA testing. I've added you t=
o the testers group in the tracker, so you can now pass or fail QA tests. Ho=
pefully the process is fully explained in <a href=3D"http://docs.moodle.org/=
dev/QA_testing" x-apple-data-detectors=3D"true" x-apple-data-detectors-type=3D=
"link" x-apple-data-detectors-result=3D"1">https://moodledev.io/general/development/process/testing/qa=
</a> but if there's anything you're not sure about, please post in the t=
esting and QA forum.</span></p><span style=3D"-webkit-text-size-adjust: none=
; background-color: rgba(255, 255, 255, 0);"><br><br></span><p dir=3D"ltr" s=
tyle=3D"margin-top: 0pt; margin-bottom: 0pt;"><span style=3D"font-style: ita=
lic; vertical-align: baseline; -webkit-text-size-adjust: none; background-co=
lor: rgba(255, 255, 255, 0);">Thanks for offering to help with QA testing. P=
lease create an account in the Moodle Tracker and let me know your Tracker u=
sername then I can add you to the testers group.</span></p><span style=3D"-w=
ebkit-text-size-adjust: none; background-color: rgba(255, 255, 255, 0);"><br=
><br></span><p dir=3D"ltr" style=3D"margin-top: 0pt; margin-bottom: 0pt;"><s=
pan style=3D"font-style: italic; vertical-align: baseline; -webkit-text-size=
-adjust: none; background-color: rgba(255, 255, 255, 0);">Thanks for offerin=
g to help with QA testing. We recently finished the Moodle 2.8 QA cycle, so o=
ur next QA cycle won't be for a while, however you are welcome to try things=
out on our Moodle QA Testing site <a href=3D"http://qa.moodle.net/" x-apple=
-data-detectors=3D"true" x-apple-data-detectors-type=3D"link" x-apple-data-d=
etectors-result=3D"3">http://qa.moodle.net/</a> and post in the Testing and Q=
A forum <a href=3D"http://moodle.org/mod/forum/view.php?id=3D56" x-apple-dat=
a-detectors=3D"true" x-apple-data-detectors-type=3D"link" x-apple-data-detec=
tors-result=3D"4">http://moodle.org/mod/forum/view.php?id=3D56</a> about any=
issues you come across, or any questions you have. If you come across any b=
ugs (obvious problems), please report them in the Moodle tracker.</span></p>=
<span style=3D"-webkit-text-size-adjust: none; background-color: rgba(255, 2=
55, 255, 0);"><br><br></span><p dir=3D"ltr" style=3D"margin-top: 0pt; margin=
-bottom: 0pt;"><span style=3D"font-style: italic; vertical-align: baseline; -=
webkit-text-size-adjust: none; background-color: rgba(255, 255, 255, 0);">Th=
anks for helping with QA testing. Your help would be appreciated even more i=
f you could just add a comment when passing a test, such as feedback about t=
he feature e.g. =E2=80=9CTeachers are going to love this=E2=80=9D or even si=
mply "This test passes - yippee!" to confirm that the test wasn't accidental=
ly passed without being run.</span></p><span style=3D"-webkit-text-size-adju=
st: none; background-color: rgba(255, 255, 255, 0);"><br></span><p dir=3D"lt=
r" style=3D"margin-top: 0pt; margin-bottom: 0pt;"><span style=3D"font-style:=
italic; vertical-align: baseline; -webkit-text-size-adjust: none; backgroun=
d-color: rgba(255, 255, 255, 0);">Thanks for helping with QA testing. It has=
been observed that you assigned this issue to yourself for testing, but no a=
ction has been taken on this. &nbsp;It will be helpful if you can either tes=
t this or un-assign yourself, so someone else can take it.</span></p></td></=
tr></tbody></table><br>Sent from my iPad</div><div><br>On 4 May 2015, at 11:=
02 am, Admin User &lt;<a href=3D"mailto:andrew@nicols.co.uk">andrew@nicols.c=
o.uk</a>&gt; wrote:<br><br></div><blockquote type=3D"cite"><div>
<div class=3D"navbar"><a target=3D"_blank" href=3D"http://banana.per.in.mood=
le.com/mdl48002/course/view.php?id=3D3">MDL-48002</a> =C2=BB <a target=3D"_b=
lank" href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/index.php?i=
d=3D3">Forums</a> =C2=BB <a target=3D"_blank" href=3D"http://banana.per.in.m=
oodle.com/mdl48002/mod/forum/view.php?f=3D5">MDL-48002</a> =C2=BB <a target=3D=
"_blank" href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/discuss.=
php?d=3D8">Testing of MDL-48002</a></div><table border=3D"0" cellpadding=3D"=
3" cellspacing=3D"0" class=3D"forumpost"><tbody><tr class=3D"header"><td wid=
th=3D"35" valign=3D"top" class=3D"picture left"><a href=3D"http://banana.per=
.in.moodle.com/mdl48002/user/view.php?id=3D2&amp;course=3D3"><img src=3D"htt=
p://banana.per.in.moodle.com/mdl48002/theme/image.php/_s/clean/core/14307067=
79/u/f2" alt=3D"Picture of Admin User" title=3D"Picture of Admin User" class=
=3D"userpicture defaultuserpic" width=3D"35" height=3D"35"></a></td><td clas=
s=3D"topic starter"><div class=3D"subject">Testing of MDL-48002</div><div cl=
ass=3D"author">by <a href=3D"http://banana.per.in.moodle.com/mdl48002/user/v=
iew.php?id=3D2&amp;course=3D3">Admin User</a> - Monday, 4 May 2015, 10:48 AM=
</div></td></tr><tr><td class=3D"left side" valign=3D"top">&nbsp;</td><td cl=
ass=3D"content"><p>We are trying to test that this issue will work as expect=
ed.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis conv=
allis pharetra justo dignissim cursus. Sed sagittis, velit vel scelerisque s=
ollicitudin, neque purus pulvinar nisi, quis semper urna dolor nec est. Maec=
enas ut dui accumsan, tincidunt sem ac, efficitur lorem. Vivamus consequat v=
iverra eros eget cursus. Morbi porttitor nunc vehicula consequat laoreet. Pe=
llentesque ac diam vel libero finibus sodales a fringilla erat. Ut elementum=
ante eget convallis dignissim. Proin iaculis mauris nec diam maximus, ac sc=
elerisque metus tincidunt. Nullam tincidunt turpis ut aliquam volutpat. Vest=
ibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia=
Curae; Donec neque quam, sollicitudin bibendum ipsum id, malesuada convalli=
s orci.</p><p>Cras posuere, velit et consectetur euismod, orci ante malesuad=
a libero, eu tincidunt tortor elit vitae tellus. Nunc vel felis id metus fri=
ngilla lobortis. Sed sit amet ipsum vitae dolor aliquet dapibus eu vel nulla=
. Sed id dui nec nisl hendrerit blandit ut et turpis. Donec dictum nunc maur=
is, quis placerat tellus fermentum ac. Phasellus at fermentum quam. Phasellu=
s magna magna, pharetra pharetra pellentesque a, convallis non leo. Nunc ac s=
emper est. Ut interdum condimentum nunc sit amet sollicitudin. Aenean vitae s=
odales dolor, vitae porta felis. Aliquam tincidunt posuere lorem sed mollis.=
Vestibulum sed quam convallis, commodo ante et, rhoncus metus. Sed arcu dia=
m, venenatis vel urna eu, porta viverra massa. Suspendisse nec consectetur r=
isus, quis hendrerit arcu. Ut purus metus, varius sit amet mauris non, posue=
re ultricies velit. Nullam nec luctus lorem.</p><p>Proin quis turpis efficit=
ur, auctor dui nec, vulputate ligula. Sed egestas facilisis magna nec posuer=
e. Nam nisl nibh, dictum in velit eget, dapibus euismod lacus. Phasellus mol=
lis eros nibh, eu venenatis libero luctus eu. Etiam ultricies turpis interdu=
m, rutrum leo sed, sollicitudin lectus. Suspendisse potenti. Vestibulum in p=
urus orci. Pellentesque fringilla nunc ac diam tristique pellentesque. Duis t=
incidunt mi ipsum, ac consequat augue iaculis a. Ut ut erat at lacus loborti=
s facilisis at at ipsum. Aliquam ut nisi posuere, dictum arcu id, placerat n=
isl. Vivamus in ex et lorem tempor iaculis elementum quis nunc.</p><p>Some m=
ore text here.</p><p>Now in the reply we will not remove the content and sen=
t a bit of a reply.</p><div class=3D"commands"><a target=3D"_blank" href=3D"=
http://banana.per.in.moodle.com/mdl48002/mod/forum/post.php?reply=3D24">Repl=
y</a></div><div class=3D"link"><a target=3D"_blank" href=3D"http://banana.pe=
r.in.moodle.com/mdl48002/mod/forum/discuss.php?d=3D8#p24">See this post in c=
ontext</a></div></td></tr></tbody></table>
<hr><div class=3D"mdl-align unsubscribelink"><a href=3D"http://banana.per.in=
.moodle.com/mdl48002/mod/forum/subscribe.php?id=3D5&amp;d=3D8">Unsubscribe f=
rom this discussion</a>&nbsp;<a href=3D"http://banana.per.in.moodle.com/mdl4=
8002/mod/forum/unsubscribeall.php">Unsubscribe from all forums</a>&nbsp;<a h=
ref=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/index.php?id=3D3">=
Change your forum digest preferences</a></div><p>You can reply to this via e=
mail.</p>
</div></blockquote></body></html>=
--Apple-Mail-97963C5D-72E2-413A-89FF-624233E4337F--
+262
View File
@@ -0,0 +1,262 @@
----CLIENT----
OS: Win 7
Mail Client: Outlook 2013
Client Version: 15.0.4569.1503
Date: 04/05/2015
----EXPECTEDPLAIN----
Sending mail via clent and it seems to go all good...
Havent tried this before and it is awesome....
Cheers
Rajesh
----EXPECTEDHTML----
Sending mail via clent and it seems to go all good...
Havent tried this before and it is awesome....
Cheers
Rajesh
----FULLSOURCE----
Delivered-To: moodlehqtest+aaaaaaaaaaiaaaaaaaaabqaaaaaaaaazd63zvl6kcy04ioh+@example.com
Received: by 10.50.159.130 with SMTP id xc2csp1452325igb;
Sun, 3 May 2015 20:06:33 -0700 (PDT)
X-Received: by 10.182.42.131 with SMTP id o3mr16558872obl.59.1430708792759;
Sun, 03 May 2015 20:06:32 -0700 (PDT)
Return-Path: <rajesh.taneja@example.com>
Received: from mail-oi0-x232.google.com (mail-oi0-x232.google.com. [2607:f8b0:4003:c06::232])
by mx.google.com with ESMTPS id bb9si7457620obb.49.2015.05.03.20.06.32
for <moodlehqtest+AAAAAAAAAAIAAAAAAAAABQAAAAAAAAAZD63zvl6KcY04ioh+@example.com>
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Sun, 03 May 2015 20:06:32 -0700 (PDT)
Received-SPF: pass (google.com: domain of rajesh.taneja@example.com designates 2607:f8b0:4003:c06::232 as permitted sender) client-ip=2607:f8b0:4003:c06::232;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of rajesh.taneja@example.com designates 2607:f8b0:4003:c06::232 as permitted sender) smtp.mail=rajesh.taneja@example.com;
dkim=pass header.i=@example.com;
dmarc=pass (p=NONE dis=NONE) header.from=example.com
Received: by mail-oi0-x232.google.com with SMTP id o83so103034701oik.1
for <moodlehqtest+AAAAAAAAAAIAAAAAAAAABQAAAAAAAAAZD63zvl6KcY04ioh+@example.com>; Sun, 03 May 2015 20:06:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=example.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=PP8NIhvbaEoIB2TwtsICSY6RhRgAhmJDKfcS/XCrsjk=;
b=bEJMEs0yNfdFSzchg5vhQXD6W9MuubLtBBZzLRE6UHCW93ZxgTwFJXjyEq5ZAGiWT6
2g5feEHEe6CYYOojIVGy10yh0l1XfK6kn4VgnzFTHO65RtqKggrYjijpsqqFY6moE5QC
F1gakGp7mpaT72QVx/Pu+L9rwO1MA4vfG2RstjWZMPD/dzS2HlrYwjsI8ScpO4u/oros
xl9/xWQ6brRi0co1ISSHgsaYWYAcgt6uSpGzzyL8OAA5vVWnxBSKVg+zYxY3rIo7Xbd+
vfg/Ne1CkkQ4mM4ig4P7vDQBtgN5mm6I4GF5y3uSd2asr4Wjsw183vqSc8OhfvNL2owy
m59w==
MIME-Version: 1.0
X-Received: by 10.202.230.11 with SMTP id d11mr15578479oih.6.1430708792570;
Sun, 03 May 2015 20:06:32 -0700 (PDT)
Received: by 10.202.0.68 with HTTP; Sun, 3 May 2015 20:06:32 -0700 (PDT)
Received: by 10.202.0.68 with HTTP; Sun, 3 May 2015 20:06:32 -0700 (PDT)
In-Reply-To: <669f8f3b6ac48139941bed5fcd069b97801de3b6920fe49cf6be18a5e23db0e8@banana.per.in.moodle.com>
References: <a2cf1c399f255d43697f2ca2094f09ec00779b255ae27bb457557dcc0de72d04@banana.per.in.moodle.com>
<669f8f3b6ac48139941bed5fcd069b97801de3b6920fe49cf6be18a5e23db0e8@banana.per.in.moodle.com>
Date: Mon, 4 May 2015 11:06:32 +0800
Message-ID: <CAEavSoBRiVHuk3hX9G8hbgPhJPb4KTfcjS-Kq2Qh_gdkP6hgEA@mail.example.com>
Subject: Re: MDL-48002: Re: Testing of MDL-48002
From: Rajesh Taneja <rajesh.taneja@example.com>
To: moodlehqtest+AAAAAAAAAAIAAAAAAAAABQAAAAAAAAAZD63zvl6KcY04ioh+@example.com
Content-Type: multipart/alternative; boundary=001a1140761a5bdf4c051538d992
--001a1140761a5bdf4c051538d992
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Sending mail via clent and it seems to go all good...
Havent tried this before and it is awesome....
Cheers
Rajesh
On 4 May 2015 11:01 am, "Rajesh Taneja" <rajesh.taneja@example.com> wrote:
> MDL-48002 <http://banana.per.in.moodle.com/mdl48002/course/view.php?id=
=3D3>
> =C2=BB Forums
> <http://banana.per.in.moodle.com/mdl48002/mod/forum/index.php?id=3D3> =C2=
=BB
> MDL-48002
> <http://banana.per.in.moodle.com/mdl48002/mod/forum/view.php?f=3D5> =C2=
=BB Testing
> of MDL-48002
> <http://banana.per.in.moodle.com/mdl48002/mod/forum/discuss.php?d=3D8>
> [image: Picture of Rajesh Taneja]
> <http://banana.per.in.moodle.com/mdl48002/user/view.php?id=3D5&course=3D3=
>
> Re: Testing of MDL-48002
> by Rajesh Taneja
> <http://banana.per.in.moodle.com/mdl48002/user/view.php?id=3D5&course=3D3=
> -
> Monday, 4 May 2015, 11:02 AM
>
>
> Sample reply messages:
>
> Thanks for offering to help with QA testing. I've added you to the tester=
s
> group in the tracker, so you can now pass or fail QA tests. Hopefully the
> process is fully explained in https://moodledev.io/general/development/process/testing/qa but
> if there's anything you're not sure about, please post in the testing and
> QA forum.
>
>
> Thanks for offering to help with QA testing. Please create an account in
> the Moodle Tracker and let me know your Tracker username then I can add y=
ou
> to the testers group.
>
>
> Thanks for offering to help with QA testing. We recently finished the
> Moodle 2.8 QA cycle, so our next QA cycle won't be for a while, however y=
ou
> are welcome to try things out on our Moodle QA Testing site
> http://qa.moodle.net/ and post in the Testing and QA forum
> http://moodle.org/mod/forum/view.php?id=3D56 about any issues you come
> across, or any questions you have. If you come across any bugs (obvious
> problems), please report them in the Moodle tracker.
>
>
> Thanks for helping with QA testing. Your help would be appreciated even
> more if you could just add a comment when passing a test, such as feedbac=
k
> about the feature e.g. =E2=80=9CTeachers are going to love this=E2=80=9D =
or even simply
> "This test passes - yippee!" to confirm that the test wasn't accidentally
> passed without being run.
>
> Thanks for helping with QA testing. It has been observed that you assigne=
d
> this issue to yourself for testing, but no action has been taken on this.
> It will be helpful if you can either test this or un-assign yourself, so
> someone else can take it.
>
>
> Show parent
> <http://banana.per.in.moodle.com/mdl48002/mod/forum/discuss.php?d=3D8&par=
ent=3D24>
> | Reply
> <http://banana.per.in.moodle.com/mdl48002/mod/forum/post.php?reply=3D25>
> See this post in context
> <http://banana.per.in.moodle.com/mdl48002/mod/forum/discuss.php?d=3D8#p25=
>
> ------------------------------
> Unsubscribe from this forum
> <http://banana.per.in.moodle.com/mdl48002/mod/forum/subscribe.php?id=3D5>=
Unsubscribe
> from this discussion
> <http://banana.per.in.moodle.com/mdl48002/mod/forum/subscribe.php?id=3D5&=
d=3D8>
> Unsubscribe from all forums
> <http://banana.per.in.moodle.com/mdl48002/mod/forum/unsubscribeall.php> C=
hange
> your forum digest preferences
> <http://banana.per.in.moodle.com/mdl48002/mod/forum/index.php?id=3D3>
>
> You can reply to this via email.
>
--001a1140761a5bdf4c051538d992
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<p dir=3D"ltr">Sending mail via clent and it seems to go all good...</p>
<p dir=3D"ltr">Havent tried this before and it is awesome....</p>
<p dir=3D"ltr">Cheers<br>
Rajesh</p>
<div class=3D"gmail_quote">On 4 May 2015 11:01 am, &quot;Rajesh Taneja&quot=
; &lt;<a href=3D"mailto:rajesh.taneja@example.com">rajesh.taneja@example.com</a=
>&gt; wrote:<br type=3D"attribution"><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div><a href=3D"http://banana.per.in.moodle.com/mdl48002/course/view.php?id=
=3D3" target=3D"_blank">MDL-48002</a> =C2=BB <a href=3D"http://banana.per.i=
n.moodle.com/mdl48002/mod/forum/index.php?id=3D3" target=3D"_blank">Forums<=
/a> =C2=BB <a href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/vi=
ew.php?f=3D5" target=3D"_blank">MDL-48002</a> =C2=BB <a href=3D"http://bana=
na.per.in.moodle.com/mdl48002/mod/forum/discuss.php?d=3D8" target=3D"_blank=
">Testing of MDL-48002</a></div><table border=3D"0" cellpadding=3D"3" cells=
pacing=3D"0"><tr><td width=3D"35" valign=3D"top"><a href=3D"http://banana.p=
er.in.moodle.com/mdl48002/user/view.php?id=3D5&amp;course=3D3" target=3D"_b=
lank"><img src=3D"http://banana.per.in.moodle.com/mdl48002/theme/image.php/=
_s/clean/core/1430706779/u/f2" alt=3D"Picture of Rajesh Taneja" title=3D"Pi=
cture of Rajesh Taneja" width=3D"35" height=3D"35"></a></td><td><div>Re: Te=
sting of MDL-48002</div><div>by <a href=3D"http://banana.per.in.moodle.com/=
mdl48002/user/view.php?id=3D5&amp;course=3D3" target=3D"_blank">Rajesh Tane=
ja</a> - Monday, 4 May 2015, 11:02 AM</div></td></tr><tr><td valign=3D"top"=
>=C2=A0</td><td><p><b style=3D"font-weight:normal"></b></p><p dir=3D"ltr" s=
tyle=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style=3D"f=
ont-size:16px;font-family:Arial;color:#000000;background-color:transparent;=
font-weight:normal;font-style:normal;font-variant:normal;text-decoration:no=
ne;vertical-align:baseline;white-space:pre-wrap">Sample reply messages:</sp=
an></p><br><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margin-b=
ottom:0pt"><span style=3D"font-size:16px;font-family:Arial;color:#000000;ba=
ckground-color:transparent;font-weight:normal;font-style:italic;font-varian=
t:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"=
>Thanks for offering to help with QA testing. I&#39;ve added you to the tes=
ters group in the tracker, so you can now pass or fail QA tests. Hopefully =
the process is fully explained in <a href=3D"https://moodledev.io/general/d=
evelopment/process/testing/qa" target=3D"_blank">https://moodledev.io/general/development/process/testing/qa</a> but if=
there&#39;s anything you&#39;re not sure about, please post in the testing=
and QA forum.</span></p><br><br><p dir=3D"ltr" style=3D"line-height:1.44;m=
argin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:16px;font-family:=
Arial;color:#000000;background-color:transparent;font-weight:normal;font-st=
yle:italic;font-variant:normal;text-decoration:none;vertical-align:baseline=
;white-space:pre-wrap">Thanks for offering to help with QA testing. Please =
create an account in the Moodle Tracker and let me know your Tracker userna=
me then I can add you to the testers group.</span></p><br><br><p dir=3D"ltr=
" style=3D"line-height:1.44;margin-top:0pt;margin-bottom:0pt"><span style=
=3D"font-size:16px;font-family:Arial;color:#000000;background-color:transpa=
rent;font-weight:normal;font-style:italic;font-variant:normal;text-decorati=
on:none;vertical-align:baseline;white-space:pre-wrap">Thanks for offering t=
o help with QA testing. We recently finished the Moodle 2.8 QA cycle, so ou=
r next QA cycle won&#39;t be for a while, however you are welcome to try th=
ings out on our Moodle QA Testing site <a href=3D"http://qa.moodle.net/" ta=
rget=3D"_blank">http://qa.moodle.net/</a> and post in the Testing and QA fo=
rum <a href=3D"http://moodle.org/mod/forum/view.php?id=3D56" target=3D"_bla=
nk">http://moodle.org/mod/forum/view.php?id=3D56</a> about any issues you c=
ome across, or any questions you have. If you come across any bugs (obvious=
problems), please report them in the Moodle tracker.</span></p><br><br><p =
dir=3D"ltr" style=3D"line-height:1.44;margin-top:0pt;margin-bottom:0pt"><sp=
an style=3D"font-size:16px;font-family:Arial;color:#000000;background-color=
:transparent;font-weight:normal;font-style:italic;font-variant:normal;text-=
decoration:none;vertical-align:baseline;white-space:pre-wrap">Thanks for he=
lping with QA testing. Your help would be appreciated even more if you coul=
d just add a comment when passing a test, such as feedback about the featur=
e e.g. =E2=80=9CTeachers are going to love this=E2=80=9D or even simply &qu=
ot;This test passes - yippee!&quot; to confirm that the test wasn&#39;t acc=
identally passed without being run.</span></p><br><p dir=3D"ltr" style=3D"l=
ine-height:1.44;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:=
16px;font-family:Arial;color:#000000;background-color:transparent;font-weig=
ht:normal;font-style:italic;font-variant:normal;text-decoration:none;vertic=
al-align:baseline;white-space:pre-wrap">Thanks for helping with QA testing.=
It has been observed that you assigned this issue to yourself for testing,=
but no action has been taken on this.=C2=A0 It will be helpful if you can =
either test this or un-assign yourself, so someone else can take it.</span>=
</p><br><br><div><a href=3D"http://banana.per.in.moodle.com/mdl48002/mod/fo=
rum/discuss.php?d=3D8&amp;parent=3D24" target=3D"_blank">Show parent</a> | =
<a href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/post.php?repl=
y=3D25" target=3D"_blank">Reply</a></div><div><a href=3D"http://banana.per.=
in.moodle.com/mdl48002/mod/forum/discuss.php?d=3D8#p25" target=3D"_blank">S=
ee this post in context</a></div></td></tr></table>
<hr><div><a href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/subs=
cribe.php?id=3D5" target=3D"_blank">Unsubscribe from this forum</a>=C2=A0<a=
href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/subscribe.php?i=
d=3D5&amp;d=3D8" target=3D"_blank">Unsubscribe from this discussion</a>=C2=
=A0<a href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/unsubscrib=
eall.php" target=3D"_blank">Unsubscribe from all forums</a>=C2=A0<a href=3D=
"http://banana.per.in.moodle.com/mdl48002/mod/forum/index.php?id=3D3" targe=
t=3D"_blank">Change your forum digest preferences</a></div></div><p>You can=
reply to this via email.</p>
</blockquote></div>
--001a1140761a5bdf4c051538d992--
+42
View File
@@ -0,0 +1,42 @@
BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 14.0 MIMEDIR//EN
VERSION:2.0
METHOD:PUBLISH
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VTIMEZONE
TZID:Central Standard Time
BEGIN:STANDARD
DTSTART:16011104T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
TZOFFSETFROM:-0500
TZOFFSETTO:-0600
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010311T020000
RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
TZOFFSETFROM:-0600
TZOFFSETTO:-0500
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
CLASS:PUBLIC
CREATED:20140916T144857Z
DESCRIPTION:\n
DTSTART;TZID="Central Standard Time":20140916T090000
DTSTAMP:20140916T144857Z
DTEND;TZID="Central Standard Time":20140916T093000
LAST-MODIFIED:20140916T144857Z
PRIORITY:5
SEQUENCE:0
SUMMARY;LANGUAGE=en-us:test
TRANSP:OPAQUE
UID:040000008200E00074C5B7101A82E0080000000000D9F06393D1CF010000000000000000100000007B710E58C9CE8146B1403BF7E84162FB
X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE>\n<HTML>\n<HEAD>\n<TITLE></TITLE>\n</HEAD>\n<BODY>\n<!-- Converted from text/rtf format -->\n\n<P DIR=LTR></P>\n\n</BODY>\n</HTML>
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-DISALLOW-COUNTER:FALSE
X-MS-OLK-AUTOFILLLOCATION:TRUE
X-MS-OLK-AUTOSTARTCHECK:FALSE
X-MS-OLK-CONFTYPE:0
END:VEVENT
END:VCALENDAR
+49
View File
@@ -0,0 +1,49 @@
<?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/>.
/**
* A form inside a namespace to be used by unit tests.
*
* See issue MDL-56233
*
* @package core
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace local_unittests\namespaced_form;
defined('MOODLE_INTERNAL') || die();
/**
* exampleform class.
*
* @package core
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class exampleform extends \moodleform {
/**
* Create a simple form definition.
*/
public function definition() {
$mform = $this->_form;
$mform->addElement('text', 'title', 'title_value');
$mform->setType('title', PARAM_TEXT);
}
}
+36
View File
@@ -0,0 +1,36 @@
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
VERSION:2.0
METHOD:PUBLISH
X-WR-CALNAME:pokus
X-WR-TIMEZONE:Pacific/Auckland
X-APPLE-CALENDAR-COLOR:#1BADF8
BEGIN:VTIMEZONE
TZID:Pacific/Auckland
BEGIN:DAYLIGHT
TZOFFSETFROM:+1200
RRULE:FREQ=YEARLY;BYMONTH=9;BYDAY=-1SU
DTSTART:20070930T020000
TZNAME:NZDT
TZOFFSETTO:+1300
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+1300
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=1SU
DTSTART:20080406T030000
TZNAME:NZST
TZOFFSETTO:+1200
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20141028T204253Z
UID:5571BBDC-AC05-4486-9E57-118EBDFFA385
DTEND;TZID=Pacific/Auckland:20140917T023000
TRANSP:OPAQUE
SUMMARY:Test event
DTSTART;TZID=Pacific/Auckland:20140917T020000
DTSTAMP:20141028T204253Z
SEQUENCE:0
DESCRIPTION:This is a note.
END:VEVENT
END:VCALENDAR
+70
View File
@@ -0,0 +1,70 @@
<?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/>.
/**
* Fixture for testing the functionality of read-only forms.
*
* @package core
* @copyright 2018 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../../../config.php');
require_once($CFG->libdir . '/formslib.php');
$sections = optional_param('sections', 2, PARAM_INT);
require_login();
/**
* The form used for testing.
*/
class test_read_only_form extends moodleform {
protected function definition() {
$mform = $this->_form;
$sections = $this->_customdata;
$mform->addElement('header', 'sectionheader', 'First section');
$mform->addElement('text', 'name', 'Name');
$mform->setDefault('name', 'Important information');
$mform->setType('name', PARAM_RAW);
$mform->setExpanded('sectionheader', false);
if ($sections > 1) {
$mform->addElement('header', 'secondsection', 'Other section header');
$mform->addElement('text', 'other', 'Other');
$mform->setDefault('other', 'Other information');
$mform->setType('other', PARAM_RAW);
$mform->setExpanded('secondsection', false);
}
$this->add_action_buttons();
}
}
$PAGE->set_context(context_system::instance());
$PAGE->set_url('/lib/tests/fixtures/readonlyform.php');
$form = new test_read_only_form(null, $sections, 'post', '', null, false); // The false here is $editable.
echo $OUTPUT->header();
echo $form->render();
echo $OUTPUT->footer();
+34
View File
@@ -0,0 +1,34 @@
BEGIN:VCALENDAR
PRODID:QIS-LSF HIS eG
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
END:STANDARD
END:VTIMEZONE
METHOD:PUBLISH
BEGIN:VEVENT
DTSTART;TZID=Europe/Berlin:20191015T160000
DTEND;TZID=Europe/Berlin:20191015T180000
RRULE:FREQ=WEEKLY;UNTIL=20200211T235900Z;INTERVAL=1;BYDAY=TU
LOCATION:O27 - 122
DTSTAMP:20191002T151421Z
UID:115808212972
DESCRIPTION:
SUMMARY:CS6307.000 - Introduction to Computer Science (for Non-Computer Scientists)
CATEGORIES:Vorlesung/ Übung
END:VEVENT
END:VCALENDAR
+117
View File
@@ -0,0 +1,117 @@
<?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 test_component\courseformat;
use core_courseformat\base as course_format;
use core_courseformat\output\local\content\section\controlmenu;
use core_courseformat\sectiondelegate as sectiondelegatebase;
use core_courseformat\stateupdates;
use section_info;
use renderer_base;
use action_menu;
/**
* Test class for section delegate.
*
* @package core_courseformat
* @copyright 2023 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class sectiondelegate extends sectiondelegatebase {
/** @var string force the default parent action menu. */
public const MENUPARENT = 'parent';
/** @var string force an empty action menu. */
public const MENUEMPTY = 'empty';
/** @var string force a null action menu. */
public const MENUNULL = 'null';
/**
* @var string|null Status to define which action menu to return when calling get_section_action_menu().
* Alternatively, different testing classes could be created, but it wasn't worth it for this case.
*/
protected ?string $actionmenustatus = self::MENUPARENT;
/**
* Test method to fake preprocesses the section name by appending a suffix to it.
*
* @param section_info $section The section information.
* @param string|null $newname The new name for the section.
* @return string|null The preprocessed section name with the suffix appended.
*/
public function preprocess_section_name(section_info $section, ?string $newname): ?string {
if (empty($newname)) {
return 'null_name';
}
return $newname . '_suffix';
}
/**
* Test method to add state updates of a section with additional information.
*
* @param section_info $section The section to update.
* @param stateupdates $updates The state updates to apply.
* @return void
*/
public function put_section_state_extra_updates(section_info $section, stateupdates $updates): void {
$updates->add_cm_put($section->itemid);
}
/**
* Helper to change the behaviour of the get_section_action_menu(), for testing purposes, to return a different action menu
* based on the value of $actionmenustatus. For instance:
* - 'parent' returns the parent action menu.
* - 'empty' returns an empty action menu.
* - 'null' or null returns null action menu.
*
* @param string|null $actionmenustatus The status of the action menu.
*/
public function set_section_action_menu(
?string $actionmenustatus,
) {
$this->actionmenustatus = $actionmenustatus;
}
/**
* Allow delegate plugin to modify the available section menu.
* By default, it returns the parent action menu.
*
* @param course_format $format The course format instance.
* @param controlmenu $controlmenu The control menu instance.
* @param renderer_base $output The renderer instance.
* @return action_menu|null The new action menu with the list of edit control items or null if no action menu is available.
*/
public function get_section_action_menu(
course_format $format,
controlmenu $controlmenu,
renderer_base $output,
): ?action_menu {
switch ($this->actionmenustatus) {
case self::MENUPARENT:
return parent::get_section_action_menu($format, $controlmenu, $output);
case self::MENUEMPTY:
return new action_menu();
case self::MENUNULL:
default:
return null;
}
}
}
+37
View File
@@ -0,0 +1,37 @@
<?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/>.
/**
* Fixture for testing secure layout pages have no nav link.
*
* @package core
* @copyright 2019 Luca Bösch <luca.boesch@bfh.ch>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../../../config.php');
// Behat test fixture only.
defined('BEHAT_SITE_RUNNING') || die('Only available on Behat test server');
$PAGE->set_pagelayout('secure');
$PAGE->set_url('/lib/tests/fixtures/securetestpage.php');
$PAGE->set_context(context_system::instance());
echo $OUTPUT->header();
echo $OUTPUT->heading('Hello world');
echo $OUTPUT->footer();
+57
View File
@@ -0,0 +1,57 @@
<?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 core_tests\event;
/**
* Fixtures for new stats testing.
*
* @package core
* @category phpunit
* @copyright 2014 Petr Skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
class create_executed extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
}
class read_executed extends \core\event\base {
protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
}
class update_executed extends \core\event\base {
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
}
class delete_executed extends \core\event\base {
protected function init() {
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
}
+35
View File
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Tests no logs - Only query 3 should be processed -->
<dataset>
<table name="log">
<column>time</column>
<column>userid</column>
<column>course</column>
<column>action</column>
</table>
<table name="stats_daily">
<column>courseid</column>
<column>timeend</column>
<column>roleid</column>
<column>stattype</column>
<column>stat1</column>
<column>stat2</column>
<row>
<value>[course1_id]</value>
<value>[end_no_logs]</value>
<value>5</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
</table>
<table name="stats_user_daily">
<column>courseid</column>
<column>userid</column>
<column>roleid</column>
<column>timeend</column>
<column>statsreads</column>
<column>statswrites</column>
<column>stattype</column>
</table>
</dataset>
+116
View File
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- No login test - Tests queries 2, 3, 5, 7, 9 (and 8), 10 (read) -->
<dataset>
<table name="log">
<column>time</column>
<column>userid</column>
<column>course</column>
<column>action</column>
<row>
<value>[start_1]</value>
<value>[guest_id]</value>
<value>[site_id]</value>
<value>view</value>
</row>
</table>
<table name="stats_daily">
<column>courseid</column>
<column>timeend</column>
<column>roleid</column>
<column>stattype</column>
<column>stat1</column>
<column>stat2</column>
<!-- Query 2 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>logins</value>
<value>0</value>
<value>0</value>
</row>
<!-- Query 3 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[student_roleid]</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 5 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 7 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 9 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>[frontpage_roleid]</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 11 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 16 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>[guest_roleid]</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
</table>
<table name="stats_user_daily">
<column>courseid</column>
<column>userid</column>
<column>roleid</column>
<column>timeend</column>
<column>statsreads</column>
<column>statswrites</column>
<column>stattype</column>
<!-- Query 10 - read -->
<row>
<value>[site_id]</value>
<value>[guest_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>activity</value>
</row>
<!-- Query 10 - default record -->
<row>
<value>[site_id]</value>
<value>0</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
</table>
</dataset>
+117
View File
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Single login - Tests queries 1, 2 (with logins), 4 -->
<dataset>
<table name="log">
<column>time</column>
<column>userid</column>
<column>course</column>
<column>action</column>
<row>
<value>[start_1]</value>
<value>[user1_id]</value>
<value>[site_id]</value>
<value>login</value>
</row>
</table>
<table name="stats_daily">
<column>courseid</column>
<column>timeend</column>
<column>roleid</column>
<column>stattype</column>
<column>stat1</column>
<column>stat2</column>
<!-- Query 2 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>logins</value>
<value>1</value>
<value>1</value>
</row>
<!-- Query 3 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[student_roleid]</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 5 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 7 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 9 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>[frontpage_roleid]</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 11 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>0</value>
<value>0</value>
</row>
</table>
<table name="stats_user_daily">
<column>courseid</column>
<column>userid</column>
<column>roleid</column>
<column>timeend</column>
<column>statsreads</column>
<column>statswrites</column>
<column>stattype</column>
<!-- Query 1 -->
<row>
<value>[site_id]</value>
<value>[user1_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>logins</value>
</row>
<!-- Query 10 - read -->
<row>
<value>[site_id]</value>
<value>[user1_id]</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
<!-- Query 10 - default record -->
<row>
<value>[site_id]</value>
<value>0</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
</table>
</dataset>
+151
View File
@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Guest login and view course - Tests queries 11 (read), 13 (guest) -->
<dataset>
<table name="log">
<column>time</column>
<column>userid</column>
<column>course</column>
<column>action</column>
<row>
<value>[start_1]</value>
<value>[guest_id]</value>
<value>[site_id]</value>
<value>login</value>
</row>
<row>
<value>[start_2]</value>
<value>[guest_id]</value>
<value>[course1_id]</value>
<value>view</value>
</row>
</table>
<table name="stats_daily">
<column>courseid</column>
<column>timeend</column>
<column>roleid</column>
<column>stattype</column>
<column>stat1</column>
<column>stat2</column>
<!-- Query 2 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>logins</value>
<value>1</value>
<value>1</value>
</row>
<!-- Query 3 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[student_roleid]</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 5 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 7 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 9 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>[frontpage_roleid]</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 11 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>0</value>
<value>0</value>
</row>
<!-- Query 11 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 13 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[guest_roleid]</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
</table>
<table name="stats_user_daily">
<column>courseid</column>
<column>userid</column>
<column>roleid</column>
<column>timeend</column>
<column>statsreads</column>
<column>statswrites</column>
<column>stattype</column>
<!-- Query 1 -->
<row>
<value>[site_id]</value>
<value>[guest_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>logins</value>
</row>
<!-- Query 10 -->
<row>
<value>[course1_id]</value>
<value>[guest_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>activity</value>
</row>
<!-- Query 10 -->
<row>
<value>[site_id]</value>
<value>[guest_id]</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
<!-- Query 10 - default record -->
<row>
<value>[site_id]</value>
<value>0</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
</table>
</dataset>
+157
View File
@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Guest login, view course, and upload assignment - Tests queries 10+11 (write) -->
<dataset>
<table name="log">
<column>time</column>
<column>userid</column>
<column>course</column>
<column>action</column>
<row>
<value>[start_1]</value>
<value>[guest_id]</value>
<value>[site_id]</value>
<value>login</value>
</row>
<row>
<value>[start_2]</value>
<value>[guest_id]</value>
<value>[course1_id]</value>
<value>view</value>
</row>
<row>
<value>[start_3]</value>
<value>[guest_id]</value>
<value>[course1_id]</value>
<value>add post</value>
</row>
</table>
<table name="stats_daily">
<column>courseid</column>
<column>timeend</column>
<column>roleid</column>
<column>stattype</column>
<column>stat1</column>
<column>stat2</column>
<!-- Query 2 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>logins</value>
<value>1</value>
<value>1</value>
</row>
<!-- Query 3 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[student_roleid]</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 5 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 7 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 9 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>[frontpage_roleid]</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 11 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>0</value>
<value>0</value>
</row>
<!-- Query 11 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>1</value>
<value>1</value>
</row>
<!-- Query 13 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[guest_roleid]</value>
<value>activity</value>
<value>1</value>
<value>1</value>
</row>
</table>
<table name="stats_user_daily">
<column>courseid</column>
<column>userid</column>
<column>roleid</column>
<column>timeend</column>
<column>statsreads</column>
<column>statswrites</column>
<column>stattype</column>
<!-- Query 1 -->
<row>
<value>[site_id]</value>
<value>[guest_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>logins</value>
</row>
<!-- Query 10 -->
<row>
<value>[course1_id]</value>
<value>[guest_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>1</value>
<value>activity</value>
</row>
<!-- Query 10 -->
<row>
<value>[site_id]</value>
<value>[guest_id]</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
<!-- Query 10 - default record -->
<row>
<value>[site_id]</value>
<value>0</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
</table>
</dataset>
+151
View File
@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- User login and view course - Tests queries 4, 6, 10, 12, 14 (read) -->
<dataset>
<table name="log">
<column>time</column>
<column>userid</column>
<column>course</column>
<column>action</column>
<row>
<value>[start_1]</value>
<value>[user1_id]</value>
<value>[site_id]</value>
<value>login</value>
</row>
<row>
<value>[start_2]</value>
<value>[user1_id]</value>
<value>[course1_id]</value>
<value>view</value>
</row>
</table>
<table name="stats_daily">
<column>courseid</column>
<column>timeend</column>
<column>roleid</column>
<column>stattype</column>
<column>stat1</column>
<column>stat2</column>
<!-- Query 2 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>logins</value>
<value>1</value>
<value>1</value>
</row>
<!-- Queris 3 (stat1) and 4 (stat2) -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[student_roleid]</value>
<value>enrolments</value>
<value>1</value>
<value>1</value>
</row>
<!-- Queries 5 (stat1) and 6 (stat2) -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>1</value>
<value>1</value>
</row>
<!-- Query 7 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 9 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>[frontpage_roleid]</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 11 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>0</value>
<value>0</value>
</row>
<!-- Query 11 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 12 (read) -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[student_roleid]</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
</table>
<table name="stats_user_daily">
<column>courseid</column>
<column>userid</column>
<column>roleid</column>
<column>timeend</column>
<column>statsreads</column>
<column>statswrites</column>
<column>stattype</column>
<!-- Query 1 -->
<row>
<value>[site_id]</value>
<value>[user1_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>logins</value>
</row>
<!-- Query 10 -->
<row>
<value>[course1_id]</value>
<value>[user1_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>activity</value>
</row>
<!-- Query 10 -->
<row>
<value>[site_id]</value>
<value>[user1_id]</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
<!-- Query 10 - default record -->
<row>
<value>[site_id]</value>
<value>0</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
</table>
</dataset>
+157
View File
@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- User login, view course and post - Tests queries 10, 12, 14 (write) -->
<dataset>
<table name="log">
<column>time</column>
<column>userid</column>
<column>course</column>
<column>action</column>
<row>
<value>[start_1]</value>
<value>[user1_id]</value>
<value>[site_id]</value>
<value>login</value>
</row>
<row>
<value>[start_2]</value>
<value>[user1_id]</value>
<value>[course1_id]</value>
<value>view</value>
</row>
<row>
<value>[start_3]</value>
<value>[user1_id]</value>
<value>[course1_id]</value>
<value>add post</value>
</row>
</table>
<table name="stats_daily">
<column>courseid</column>
<column>timeend</column>
<column>roleid</column>
<column>stattype</column>
<column>stat1</column>
<column>stat2</column>
<!-- Query 2 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>logins</value>
<value>1</value>
<value>1</value>
</row>
<!-- Queris 3 (stat1) and 4 (stat2) -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[student_roleid]</value>
<value>enrolments</value>
<value>1</value>
<value>1</value>
</row>
<!-- Queries 5 (stat1) and 6 (stat2) -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>1</value>
<value>1</value>
</row>
<!-- Query 7 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 9 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>[frontpage_roleid]</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 11 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>0</value>
<value>0</value>
</row>
<!-- Query 11 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>1</value>
<value>1</value>
</row>
<!-- Query 12 (read) -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[student_roleid]</value>
<value>activity</value>
<value>1</value>
<value>1</value>
</row>
</table>
<table name="stats_user_daily">
<column>courseid</column>
<column>userid</column>
<column>roleid</column>
<column>timeend</column>
<column>statsreads</column>
<column>statswrites</column>
<column>stattype</column>
<!-- Query 1 -->
<row>
<value>[site_id]</value>
<value>[user1_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>logins</value>
</row>
<!-- Query 10 -->
<row>
<value>[course1_id]</value>
<value>[user1_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>1</value>
<value>activity</value>
</row>
<!-- Query 10 -->
<row>
<value>[site_id]</value>
<value>[user1_id]</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
<!-- Query 10 - default record -->
<row>
<value>[site_id]</value>
<value>0</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
</table>
</dataset>
+166
View File
@@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- User login and view course (not enrolled) - Tests queries 13 (not enroled), 14 (not default) -->
<dataset>
<table name="log">
<column>time</column>
<column>userid</column>
<column>course</column>
<column>action</column>
<row>
<value>[start_1]</value>
<value>[user2_id]</value>
<value>[site_id]</value>
<value>login</value>
</row>
<row>
<value>[start_2]</value>
<value>[user2_id]</value>
<value>[site_id]</value>
<value>view</value>
</row>
<row>
<value>[start_3]</value>
<value>[user2_id]</value>
<value>[course1_id]</value>
<value>view</value>
</row>
</table>
<table name="stats_daily">
<column>courseid</column>
<column>timeend</column>
<column>roleid</column>
<column>stattype</column>
<column>stat1</column>
<column>stat2</column>
<!-- Query 2 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>logins</value>
<value>1</value>
<value>1</value>
</row>
<!-- Query 3 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[student_roleid]</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 5 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 7 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 9 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>[frontpage_roleid]</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 11 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 11 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 13 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[guest_roleid]</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 14 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>[frontpage_roleid]</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
</table>
<table name="stats_user_daily">
<column>courseid</column>
<column>userid</column>
<column>roleid</column>
<column>timeend</column>
<column>statsreads</column>
<column>statswrites</column>
<column>stattype</column>
<!-- Query 1 -->
<row>
<value>[site_id]</value>
<value>[user2_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>logins</value>
</row>
<!-- Query 10 -->
<row>
<value>[course1_id]</value>
<value>[user2_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>activity</value>
</row>
<!-- Query 10 -->
<row>
<value>[site_id]</value>
<value>[user2_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>activity</value>
</row>
<!-- Query 10 - default record -->
<row>
<value>[site_id]</value>
<value>0</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
</table>
</dataset>
+132
View File
@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- User login and view site - Tests query 15 (front page views) -->
<dataset>
<table name="log">
<column>time</column>
<column>userid</column>
<column>course</column>
<column>action</column>
<row>
<value>[start_1]</value>
<value>[user1_id]</value>
<value>[site_id]</value>
<value>login</value>
</row>
<row>
<value>[start_2]</value>
<value>[user1_id]</value>
<value>[site_id]</value>
<value>view</value>
</row>
</table>
<table name="stats_daily">
<column>courseid</column>
<column>timeend</column>
<column>roleid</column>
<column>stattype</column>
<column>stat1</column>
<column>stat2</column>
<!-- Query 2 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>logins</value>
<value>1</value>
<value>1</value>
</row>
<!-- Query 3 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[student_roleid]</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 5 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 7 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 9 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>[frontpage_roleid]</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 11 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 15 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>[frontpage_roleid]</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
</table>
<table name="stats_user_daily">
<column>courseid</column>
<column>userid</column>
<column>roleid</column>
<column>timeend</column>
<column>statsreads</column>
<column>statswrites</column>
<column>stattype</column>
<!-- Query 1 -->
<row>
<value>[site_id]</value>
<value>[user1_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>logins</value>
</row>
<!-- Query 10 -->
<row>
<value>[site_id]</value>
<value>[user1_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>activity</value>
</row>
<!-- Query 10 - default record -->
<row>
<value>[site_id]</value>
<value>0</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
</table>
</dataset>
+129
View File
@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Multiple logins on different days -->
<dataset>
<table name="log">
<column>time</column>
<column>userid</column>
<column>course</column>
<column>action</column>
<row>
<value>[start_0]</value>
<value>[user1_id]</value>
<value>[site_id]</value>
<value>login</value>
</row>
<row>
<value>[start_1]</value>
<value>[user1_id]</value>
<value>[site_id]</value>
<value>login</value>
</row>
<row>
<value>[start_4]</value>
<value>[user1_id]</value>
<value>[site_id]</value>
<value>login</value>
</row>
</table>
<table name="stats_daily">
<column>courseid</column>
<column>timeend</column>
<column>roleid</column>
<column>stattype</column>
<column>stat1</column>
<column>stat2</column>
<!-- Query 2 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>logins</value>
<value>1</value>
<value>1</value>
</row>
<!-- Query 3 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[student_roleid]</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 5 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 7 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 9 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>[frontpage_roleid]</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 11 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
</table>
<table name="stats_user_daily">
<column>courseid</column>
<column>userid</column>
<column>roleid</column>
<column>timeend</column>
<column>statsreads</column>
<column>statswrites</column>
<column>stattype</column>
<!-- Query 1 -->
<row>
<value>[site_id]</value>
<value>[user1_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>logins</value>
</row>
<!-- Query 10 - read -->
<row>
<value>[site_id]</value>
<value>[user1_id]</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
<!-- Query 10 - default record -->
<row>
<value>[site_id]</value>
<value>0</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
</table>
</dataset>
+107
View File
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- No default profile id test -->
<dataset>
<table name="log">
<column>time</column>
<column>userid</column>
<column>course</column>
<column>action</column>
<row>
<value>[start_1]</value>
<value>[guest_id]</value>
<value>[site_id]</value>
<value>view</value>
</row>
</table>
<table name="stats_daily">
<column>courseid</column>
<column>timeend</column>
<column>roleid</column>
<column>stattype</column>
<column>stat1</column>
<column>stat2</column>
<!-- Query 2 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>logins</value>
<value>0</value>
<value>0</value>
</row>
<!-- Query 3 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>[student_roleid]</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 5 -->
<row>
<value>[course1_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 7 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>enrolments</value>
<value>4</value>
<value>1</value>
</row>
<!-- Query 11 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>0</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
<!-- Query 16 -->
<row>
<value>[site_id]</value>
<value>[end]</value>
<value>[guest_roleid]</value>
<value>activity</value>
<value>1</value>
<value>0</value>
</row>
</table>
<table name="stats_user_daily">
<column>courseid</column>
<column>userid</column>
<column>roleid</column>
<column>timeend</column>
<column>statsreads</column>
<column>statswrites</column>
<column>stattype</column>
<!-- Query 10 - read -->
<row>
<value>[site_id]</value>
<value>[guest_id]</value>
<value>0</value>
<value>[end]</value>
<value>1</value>
<value>0</value>
<value>activity</value>
</row>
<!-- Query 10 - default record -->
<row>
<value>[site_id]</value>
<value>0</value>
<value>0</value>
<value>[end]</value>
<value>0</value>
<value>0</value>
<value>activity</value>
</row>
</table>
</dataset>
+6
View File
@@ -0,0 +1,6 @@
name url "Description of map" Grade
"George Fitz" "http://www.myblog.com" "This is a small map, that could be used in anything."
"Jim Brown" "http://www.blank.ne.jp" "Difficult to follow for the first five km.
Then things get easier." 1
"Tanya Keisel" "www.google.com" "No joke, it's just all burn't up. You can't ""understand"" any of it."
1 name url Description of map Grade
2 George Fitz http://www.myblog.com This is a small map, that could be used in anything.
3 Jim Brown http://www.blank.ne.jp Difficult to follow for the first five km. Then things get easier. 1
4 Tanya Keisel www.google.com No joke, it's just all burn't up. You can't "understand" any of it.
+162
View File
@@ -0,0 +1,162 @@
<?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/>.
/**
* Fixtures for task tests.
*
* @package core
* @category phpunit
* @copyright 2014 Petr Skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\task;
defined('MOODLE_INTERNAL') || die();
/**
* Test class.
*
* @copyright 2022 Catalyst IT Australia Pty Ltd
* @author Cameron Ball <cameron@cameron1729.xyz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class adhoc_test_task extends \core\task\adhoc_task {
/**
* Constructor.
*
* @param int|null $nextruntime Next run time
* @param int|null $timestarted Time started
*/
public function __construct(?int $nextruntime = null, ?int $timestarted = null) {
if ($nextruntime) {
$this->set_next_run_time($nextruntime);
}
if ($timestarted) {
$this->set_timestarted($timestarted);
}
}
/**
* Get task name
*
* @return string
*/
public function get_name() {
return 'Test adhoc class';
}
/**
* Execute.
*/
public function execute() {
}
}
/**
* Test class.
*
* @copyright 2022 Catalyst IT Australia Pty Ltd
* @author Cameron Ball <cameron@cameron1729.xyz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class adhoc_test2_task extends adhoc_test_task {
}
/**
* Test class.
*
* @copyright 2022 Catalyst IT Australia Pty Ltd
* @author Cameron Ball <cameron@cameron1729.xyz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class adhoc_test3_task extends adhoc_test_task {
}
/**
* Test class.
*
* @copyright 2022 Catalyst IT Australia Pty Ltd
* @author Cameron Ball <cameron@cameron1729.xyz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class adhoc_test4_task extends adhoc_test_task {
}
/**
* Test class.
*
* @copyright 2022 Catalyst IT Australia Pty Ltd
* @author Cameron Ball <cameron@cameron1729.xyz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class adhoc_test5_task extends adhoc_test_task {
}
/**
* Test class for no-retry adhoc task.
*
* @package core
* @copyright 2023 Huong Nguyen <huongnv13@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class no_retry_adhoc_task extends adhoc_test_task {
/**
* Prevent the task from retrying.
* @return bool
*/
public function retry_until_success(): bool {
return false;
}
}
class scheduled_test_task extends \core\task\scheduled_task {
public function get_name() {
return "Test task";
}
public function execute() {
}
}
class scheduled_test2_task extends \core\task\scheduled_task {
public function get_name() {
return "Test task 2";
}
public function execute() {
}
}
class scheduled_test3_task extends \core\task\scheduled_task {
public function get_name() {
return "Test task 3";
}
public function execute() {
}
}
namespace mod_fake\task;
class adhoc_component_task extends \core\task\adhoc_task {
public function execute() {
}
}
+79
View File
@@ -0,0 +1,79 @@
<?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/>.
use core_external\external_api;
use core_external\external_function_parameters;
use core_external\external_single_structure;
/**
* An external function that throws an exception, for tests.
*
* @package core
* @category phpunit
* @copyright 2020 Dani Palou
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class test_external_function_throwable extends external_api {
/**
* Returns description of throw_exception() parameters.
*
* @return external_function_parameters
*/
public static function throw_exception_parameters() {
return new external_function_parameters(array());
}
/**
* Throws a PHP error.
*
* @return array empty array.
*/
public static function throw_exception() {
$a = 1 % 0;
return array();
}
/**
* Returns description of throw_exception() result value.
*
* @return \core_external\external_description
*/
public static function throw_exception_returns() {
return new external_single_structure(array());
}
/**
* Override external_function_info to accept our fake WebService.
*/
public static function external_function_info($function, $strictness=MUST_EXIST) {
if ($function == 'core_throw_exception') {
// Convert it to an object.
$function = new stdClass();
$function->name = $function;
$function->classname = 'test_external_function_throwable';
$function->methodname = 'throw_exception';
$function->classpath = ''; // No need to define class path because current file is already loaded.
$function->component = 'fake';
$function->capabilities = '';
$function->services = 'moodle_mobile_app';
$function->loginrequired = false;
}
return parent::external_function_info($function, $strictness);
}
}
+148
View File
@@ -0,0 +1,148 @@
<?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/>.
/**
* Test factory for lib/outputfactories.php.
*
* @package core
* @category phpunit
* @copyright 2014 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->libdir . '/outputfactories.php');
/**
* This is renderer factory testing of the classname autoloading.
*
* @copyright 2014 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core
* @category phpunit
*/
class test_output_factory extends renderer_factory_base {
/**
* Constructor.
*
*/
public function __construct() {
// Leave the construct empty to override the parent.
}
/**
* Not used - we want to test the autoloaded class locations - even if there are no classes yet.
*/
public function get_renderer(moodle_page $page, $component, $subtype = null, $target = null) {
throw new coding_exception('Do not call this function, this class is for testing only.');
}
/*
* Return the list of classnames searched for by the standard_renderer_factory.
*
* @param string $component name such as 'core', 'mod_forum' or 'qtype_multichoice'.
* @param string $subtype optional subtype such as 'news' resulting to 'mod_forum_news'
* @param string $target one of rendering target constants
* @return string[] of classnames
*/
public function get_standard_renderer_factory_search_paths($component, $subtype = null, $target = null) {
$classnames = $this->standard_renderer_classnames($component, $subtype);
$searchtargets = array();
list($target, $suffix) = $this->get_target_suffix($target);
// Add all suffix versions first - to match the real search order.
foreach ($classnames as $classnamedetails) {
if ($classnamedetails['validwithoutprefix']) {
$newclassname = $classnamedetails['classname'] . $suffix;
$searchtargets[] = $newclassname;
}
}
// Add all non-suffixed versions now.
foreach ($classnames as $classnamedetails) {
if ($classnamedetails['validwithoutprefix']) {
$newclassname = $classnamedetails['classname'];
$searchtargets[] = $newclassname;
}
}
return $searchtargets;
}
/**
* Return the list of classnames searched for by the get_renderer method of theme_overridden_renderer.
*
* @param string $component name such as 'core', 'mod_forum' or 'qtype_multichoice'.
* @param string $subtype optional subtype such as 'news' resulting to 'mod_forum_news'
* @param string $target one of rendering target constants
* @return string[] of classnames
*/
public function get_theme_overridden_renderer_factory_search_paths($component, $subtype = null, $target = null) {
$themeprefixes = ['theme_child', 'theme_parent'];
$searchtargets = array();
$classnames = $this->standard_renderer_classnames($component, $subtype);
list($target, $suffix) = $this->get_target_suffix($target);
// Theme lib.php and renderers.php files are loaded automatically
// when loading the theme configs.
// First try the renderers with correct suffix.
foreach ($themeprefixes as $prefix) {
foreach ($classnames as $classnamedetails) {
if ($classnamedetails['validwithprefix']) {
if ($classnamedetails['autoloaded']) {
$newclassname = $prefix . $classnamedetails['classname'] . $suffix;
} else {
$newclassname = $prefix . '_' . $classnamedetails['classname'] . $suffix;
}
$searchtargets[] = $newclassname;
}
}
}
foreach ($classnames as $classnamedetails) {
if ($classnamedetails['validwithoutprefix']) {
$newclassname = $classnamedetails['classname'] . $suffix;
$searchtargets[] = $newclassname;
}
}
// Then try general renderer.
foreach ($themeprefixes as $prefix) {
foreach ($classnames as $classnamedetails) {
if ($classnamedetails['validwithprefix']) {
if ($classnamedetails['autoloaded']) {
$newclassname = $prefix . $classnamedetails['classname'];
} else {
$newclassname = $prefix . '_' . $classnamedetails['classname'];
}
$searchtargets[] = $newclassname;
}
}
}
// Final attempt - no prefix or suffix.
foreach ($classnames as $classnamedetails) {
if ($classnamedetails['validwithoutprefix']) {
$newclassname = $classnamedetails['classname'];
$searchtargets[] = $newclassname;
}
}
return $searchtargets;
}
}
+91
View File
@@ -0,0 +1,91 @@
<?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/>.
/**
* Provides \antivirus_testable class.
*
* @package core
* @subpackage fixtures
* @category test
* @copyright 2016 Ruslan Kabalin, Lancaster University.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace antivirus_testable;
defined('MOODLE_INTERNAL') || die();
/**
* Testable antivirus plugin.
*
* @copyright 2016 Ruslan Kabalin, Lancaster University.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class scanner extends \core\antivirus\scanner {
/**
* Are the necessary antivirus settings configured?
*
* @return bool True if all necessary config settings been entered
*/
public function is_configured() {
return true;
}
/**
* Scan file.
*
* Provides fake responses for testing \core\antivirus\manager.
*
* @param string $file Full path to the file.
* @param string $filename For mocking purposes, filename defines expected response.
* @return int Scanning result constant.
*/
public function scan_file($file, $filename) {
switch ($filename) {
case 'OK':
return self::SCAN_RESULT_OK;
case 'FOUND':
return self::SCAN_RESULT_FOUND;
case 'ERROR':
return self::SCAN_RESULT_ERROR;
default:
debugging('$filename should be either OK, FOUND or ERROR.');
break;
}
}
/**
* Scan data.
*
* Provides fake responses for testing \core\antivirus\manager.
*
* @param string $data The variable containing the data to scan.
* @return int Scanning result constant.
*/
public function scan_data($data) {
switch ($data) {
case 'OK':
return self::SCAN_RESULT_OK;
case 'FOUND':
return self::SCAN_RESULT_FOUND;
case 'ERROR':
return self::SCAN_RESULT_ERROR;
default:
debugging('$data should be either OK, FOUND or ERROR.');
break;
}
}
}
+58
View File
@@ -0,0 +1,58 @@
<?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/>.
/**
* Provides testable_auth_plugin_base class.
*
* @package core
* @subpackage fixtures
* @category test
* @copyright 2024 Catalyst IT
* @author Brendan Heywood <brendan@catalyst-au.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class testable_auth_plugin_base extends \auth_plugin_base {
/**
* Override to add test auth plugin
*
* @return array of plugin classes
*/
public static function get_enabled_auth_plugin_classes(): array {
$plugins = parent::get_enabled_auth_plugin_classes();
$plugins[] = new testable_auth_plugin_base();
return $plugins;
}
/**
* Identify a Moodle account on the CLI
*
* For example a plugin might use posix_geteuid and posix_getpwuid
* to find the username of the OS level user and then match that
* against Moodle user accounts.
*
* @return null|stdClass User user record if found
*/
public function find_cli_user(): ?stdClass {
global $DB;
$user = $DB->get_record('user', ['username' => 'abcdef']);
if ($user) {
return $user;
}
return null;
}
}
+41
View File
@@ -0,0 +1,41 @@
<?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/>.
/**
* Test-specific subclass to make some protected things public.
*
* @package core
* @category test
* @copyright 2022 onwards Eloy Lafuente (stronk7) {@link https://stronk7.com}
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class testable_block_manager extends block_manager {
/**
* Resets the caches in the block manager.
* This allows blocks to be reloaded correctly.
*/
public function reset_caches() {
$this->birecordsbyregion = null;
$this->blockinstances = array();
$this->visibleblockcontent = array();
}
public function mark_loaded() {
$this->birecordsbyregion = array();
}
public function get_loaded_blocks() {
return $this->birecordsbyregion;
}
}
+106
View File
@@ -0,0 +1,106 @@
<?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/>.
/**
* Fixture for testing the functionality of core_h5p.
*
* @package core
* @subpackage fixtures
* @category test
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_h5p;
defined('MOODLE_INTERNAL') || die();
/**
* H5P factory class stub for testing purposes.
*
* This class extends the real one to return the H5P core class stub.
*
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class h5p_test_factory extends factory {
/**
* Returns an instance of the \core_h5p\core stub class.
*
* @return core_h5p\core
*/
public function get_core(): core {
if ($this->core === null ) {
$fs = new file_storage();
$language = framework::get_language();
$context = \context_system::instance();
$url = \moodle_url::make_pluginfile_url($context->id, 'core_h5p', '', null,
'', '')->out();
$this->core = new h5p_test_core($this->get_framework(), $fs, $url, $language, true);
}
return $this->core;
}
}
/**
* H5P core class stub for testing purposes.
*
* Modifies get_api_endpoint method to use local URLs.
*
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class h5p_test_core extends core {
/** @var $endpoint Endpoint URL for testing H5P API */
protected $endpoint;
/**
* Set the endpoint URL
*
* @param string $url Endpoint URL
* @return void
*/
public function set_endpoint($url): void {
$this->endpoint = $url;
}
/**
* Get the URL of the test endpoints instead of the H5P ones.
*
* If $endpoint = 'content' and $library is null, moodle_url is the endpoint of the latest version of the H5P content
* types; however, if $library is the machine name of a content type, moodle_url is the endpoint to download the content type.
* The SITES endpoint ($endpoint = 'site') may be use to get a site UUID or send site data.
*
* @param string|null $library The machineName of the library whose endpoint is requested.
* @param string $endpoint The endpoint required. Valid values: "site", "content".
* @return \moodle_url The endpoint moodle_url object.
*/
public function get_api_endpoint(?string $library = null, string $endpoint = 'content'): \moodle_url {
if ($library) {
$h5purl = $this->endpoint . '/' . $library . '.h5p';
} else if ($endpoint == 'content') {
$h5purl = $this->endpoint . '/h5pcontenttypes.json';
} else {
$h5purl = $this->endpoint . '/h5puuid.json';
}
return new \moodle_url($h5purl);
}
}
+90
View File
@@ -0,0 +1,90 @@
<?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/>.
/**
* Fixture for testing the functionality of core_media_player.
*
* @package core
* @subpackage fixtures
* @category test
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Media player stub for testing purposes.
*
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class media_test_plugin extends core_media_player {
/** @var array Array of supported extensions */
public $ext;
/** @var int Player rank */
public $rank;
/** @var int Arbitrary number */
public $num;
/**
* Constructor is used for tuning the fixture.
*
* @param int $num Number (used in output)
* @param int $rank Player rank
* @param array $ext Array of supported extensions
*/
public function __construct($num = 1, $rank = 13, $ext = array('mp3', 'flv', 'f4v', 'mp4')) {
$this->ext = $ext;
$this->rank = $rank;
$this->num = $num;
}
/**
* Generates code required to embed the player.
*
* @param array $urls URLs of media files
* @param string $name Display name; '' to use default
* @param int $width Optional width; 0 to use default
* @param int $height Optional height; 0 to use default
* @param array $options Options array
* @return string HTML code for embed
*/
public function embed($urls, $name, $width, $height, $options) {
self::pick_video_size($width, $height);
$contents = "\ntestsource=". join("\ntestsource=", $urls) .
"\ntestname=$name\ntestwidth=$width\ntestheight=$height\n<!--FALLBACK-->\n";
return html_writer::span($contents, 'mediaplugin mediaplugin_test');
}
/**
* Gets the list of file extensions supported by this media player.
*
* @return array Array of strings (extension not including dot e.g. '.mp3')
*/
public function get_supported_extensions() {
return $this->ext;
}
/**
* Gets the ranking of this player.
*
* @return int Rank
*/
public function get_rank() {
return 10;
}
}
@@ -0,0 +1,89 @@
<?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/>.
/**
* Fixture for testing the functionality of core_media_player_native.
*
* @package core
* @subpackage fixtures
* @category test
* @copyright 2019 Ruslan Kabalin
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Native media player stub for testing purposes.
*
* @copyright 2019 Ruslan Kabalin
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class media_test_native_plugin extends core_media_player_native {
/** @var int Player rank */
public $rank;
/** @var int Arbitrary number */
public $num;
/**
* Constructor is used for tuning the fixture.
*
* @param int $num Number (used in output)
* @param int $rank Player rank
*/
public function __construct($num = 1, $rank = 13) {
$this->rank = $rank;
$this->num = $num;
}
/**
* Generates code required to embed the player.
*
* @param array $urls URLs of media files
* @param string $name Display name; '' to use default
* @param int $width Optional width; 0 to use default
* @param int $height Optional height; 0 to use default
* @param array $options Options array
* @return string HTML code for embed
*/
public function embed($urls, $name, $width, $height, $options) {
$sources = array();
foreach ($urls as $url) {
$params = ['src' => $url];
$sources[] = html_writer::empty_tag('source', $params);
}
$sources = implode("\n", $sources);
$title = $this->get_name($name, $urls);
// Escape title but prevent double escaping.
$title = s(preg_replace(['/&amp;/', '/&gt;/', '/&lt;/'], ['&', '>', '<'], $title));
return <<<OET
<video class="mediaplugin mediaplugin_test" title="$title">
$sources
</video>
OET;
}
/**
* Gets the ranking of this player.
*
* @return int Rank
*/
public function get_rank() {
return 10;
}
}
+31
View File
@@ -0,0 +1,31 @@
<?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 core;
/**
* Testable version of the encryption class - just makes it possible to unit-test protected
* function.
*
* @package core
* @copyright 2020 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class testable_encryption extends encryption {
public static function get_key(?string $method = null): string {
return parent::get_key($method);
}
}
+45
View File
@@ -0,0 +1,45 @@
<?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/>.
/**
* Provides testable_flexible_table class.
*
* @package core
* @subpackage fixtures
* @category test
* @copyright 2015 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Testable subclass of flexible_table providing access to some protected methods.
*
* @copyright 2015 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class testable_flexible_table extends flexible_table {
/**
* Provides access to flexible_table::can_be_reset() method.
*
* @return bool
*/
public function can_be_reset() {
return parent::can_be_reset();
}
}
+124
View File
@@ -0,0 +1,124 @@
<?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/>.
/**
* Provides testable_core_plugin_manager class.
*
* @package core
* @category test
* @copyright 2015 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__.'/testable_update_api.php');
/**
* Testable variant of the core_plugin_manager
*
* @copyright 2015 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class testable_core_plugin_manager extends core_plugin_manager {
/** @var testable_core_plugin_manager holds the singleton instance */
protected static $singletoninstance;
/**
* Allows us to inject items directly into the plugins info tree.
*
* Do not forget to call our reset_caches() after using this method to force a new
* singleton instance.
*
* @param string $type plugin type
* @param string $name plugin name
* @param \core\plugininfo\base $plugininfo plugin info class
*/
public function inject_testable_plugininfo($type, $name, \core\plugininfo\base $plugininfo) {
// Let the parent initialize the ->pluginsinfo tree.
parent::get_plugins();
// Inject the additional plugin info.
$this->pluginsinfo[$type][$name] = $plugininfo;
}
/**
* Returns testable subclass of the client.
*
* @return \core\update\testable_api
*/
protected function get_update_api_client() {
return \core\update\testable_api::client();
}
/**
* Mockup implementation of loading available updates info.
*
* This testable implementation does not actually use
* {@link \core\update\checker}. Instead, it provides hard-coded list of
* fictional available updates for our foo_bar plugin.
*
* Note there is a difference in the behaviour as the actual update API
* does not return info of lower version than requested. To mock up well,
* make sure the injected foo_bar testable plugin info has version lower
* than the lowest one returned here.
*
* @param string $component
* @return array|null array of \core\update\info objects or null
*/
public function load_available_updates_for_plugin($component) {
if ($component === 'foo_bar') {
$updates = array();
$updates[] = new \core\update\info($component, array(
'version' => '2015093000',
'release' => 'Foo bar 15.09.30 beta',
'maturity' => MATURITY_BETA,
));
$updates[] = new \core\update\info($component, array(
'version' => '2015100400',
'release' => 'Foo bar 15.10.04',
'maturity' => MATURITY_STABLE,
));
$updates[] = new \core\update\info($component, array(
'version' => '2015100500',
'release' => 'Foo bar 15.10.05 beta',
'maturity' => MATURITY_BETA,
));
return $updates;
}
return null;
}
/**
* Adds fake plugin information from record.
*
* @param testable_plugininfo_base $record
* @return void
*/
public function add_fake_plugin_info($record): void {
$this->load_present_plugins();
$this->presentplugins[$record->type][$record->name] = $record;
}
}
+51
View File
@@ -0,0 +1,51 @@
<?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/>.
/**
* Provides testable_plugininfo_base class.
*
* @package core
* @category test
* @copyright 2015 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Testable plugininfo subclass representing a fake plugin type instance.
*
* @copyright 2015 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class testable_plugininfo_base extends \core\plugininfo\base {
public static function fake_plugin_instance($type, $typerootdir, $name, $namerootdir, $typeclass, $pluginman) {
return self::make_plugin_instance($type, $typerootdir, $name, $namerootdir, $typeclass, $pluginman);
}
public function init_display_name() {
$this->displayname = 'Testable fake pluginfo instance';
}
public function load_db_version() {
$this->versiondb = null;
}
public function init_is_standard() {
$this->source = core_plugin_manager::PLUGIN_SOURCE_EXTENSION;
}
}
+210
View File
@@ -0,0 +1,210 @@
<?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/>.
/**
* Provides \core\update\testable_api class.
*
* @package core_plugin
* @subpackage fixtures
* @category test
* @copyright 2015 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\update;
defined('MOODLE_INTERNAL') || die();
/**
* Testable variant of \core\update\api class.
*
* Provides access to some protected methods we want to explicitly test and
* bypass the actual cURL calls by providing fake responses.
*
* @copyright 2015 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class testable_api extends api {
/**
* Provides access to the parent protected method.
*
* @param int $branch
* @return string
*/
public function convert_branch_numbering_format($branch) {
return parent::convert_branch_numbering_format($branch);
}
/**
* Returns fake URL of the pluginfo.php API end-point.
*
* @return string
*/
protected function get_serviceurl_pluginfo() {
return 'http://testab.le/api/pluginfo.php';
}
/**
* Mimics the call to the given end-point service with the given parameters.
*
* This simulates a hypothetical plugins directory with a single plugin
* 'foo_bar' available (with a single release).
*
* @param string $serviceurl
* @param array $params
* @return stdClass|bool
*/
protected function call_service($serviceurl, array $params=array()) {
$response = (object)array(
'data' => null,
'info' => null,
'status' => null,
);
$foobarinfo = (object)array(
'status' => 'OK',
'apiver' => '1.3',
'pluginfo' => (object)array(
'id' => 42,
'name' => 'Foo bar',
'component' => 'foo_bar',
'source' => '',
'doc' => '',
'bugs' => '',
'discussion' => '',
'version' => false,
),
);
$version2015093000info = (object)array(
'id' => '6765',
'version' => '2015093000',
'release' => '1.0',
'maturity' => '200',
'downloadurl' => 'http://mood.le/plugins/foo_bar/2015093000.zip',
'downloadmd5' => 'd41d8cd98f00b204e9800998ecf8427e',
'vcssystem' => '',
'vcssystemother' => '',
'vcsrepositoryurl' => '',
'vcsbranch' => '',
'vcstag' => '',
'supportedmoodles' => array(
(object)array(
'version' => '2015041700',
'release' => '2.9'
),
(object)array(
'version' => '2015110900',
'release' => '3.0'
),
)
);
$version2015100400info = (object)array(
'id' => '6796',
'version' => '2015100400',
'release' => '1.1',
'maturity' => '200',
'downloadurl' => 'http://mood.le/plugins/foo_bar/2015100400.zip',
'downloadmd5' => 'd41d8cd98f00b204e9800998ecf8427e',
'vcssystem' => '',
'vcssystemother' => '',
'vcsrepositoryurl' => '',
'vcsbranch' => '',
'vcstag' => '',
'supportedmoodles' => array(
(object)array(
'version' => '2015110900',
'release' => '3.0'
),
)
);
$version2015100500info = (object)array(
'id' => '6799',
'version' => '2015100500',
'release' => '2.0beta',
'maturity' => '100',
'downloadurl' => 'http://mood.le/plugins/foo_bar/2015100500.zip',
'downloadmd5' => 'd41d8cd98f00b204e9800998ecf8427e',
'vcssystem' => '',
'vcssystemother' => '',
'vcsrepositoryurl' => '',
'vcsbranch' => '',
'vcstag' => '',
'supportedmoodles' => array(
(object)array(
'version' => '2015110900',
'release' => '3.0'
),
)
);
if ($serviceurl === 'http://testab.le/api/pluginfo.php') {
if (strpos($params['plugin'], 'foo_bar@') === 0) {
$response->data = $foobarinfo;
$response->info = array(
'http_code' => 200,
);
$response->status = '200 OK';
if (substr($params['plugin'], -11) === '@2015093000') {
$response->data->pluginfo->version = $version2015093000info;
}
if (substr($params['plugin'], -11) === '@2015100400') {
$response->data->pluginfo->version = $version2015100400info;
}
if (substr($params['plugin'], -11) === '@2015100500') {
$response->data->pluginfo->version = $version2015100500info;
}
} else if ($params['plugin'] === 'foo_bar' and isset($params['branch']) and isset($params['minversion'])) {
$response->data = $foobarinfo;
$response->info = array(
'http_code' => 200,
);
$response->status = '200 OK';
if ($params['minversion'] <= 2015100400) {
// If two stable versions fullfilling the required version are
// available, the /1.3/pluginfo.php API returns the more recent one.
$response->data->pluginfo->version = $version2015100400info;
} else if ($params['minversion'] <= 2015100500) {
// The /1.3/pluginfo.php API returns versions with lower
// maturity if it is the only way how to fullfil the
// required minimal version.
$response->data->pluginfo->version = $version2015100500info;
}
} else {
$response->info = array(
'http_code' => 404,
);
$response->status = '404 Not Found (unknown plugin)';
}
return $response;
} else {
return 'This should not happen';
}
}
}

Some files were not shown because too many files have changed in this diff Show More