forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-82431 phpunit: correct unit test filename and classname.
Standardise the same test cases, e.g. make final, covers notation, static data providers, namespaces, etc. Once the tests run, a couple of them failed. They required changes to assertions to make them pass.
- Loading branch information
1 parent
7d7a871
commit 8413f61
Showing
9 changed files
with
72 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,16 +14,6 @@ | |
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* External function test for delete_entry. | ||
* | ||
* @package mod_glossary | ||
* @category external | ||
* @since Moodle 3.10 | ||
* @copyright 2020 Juan Leyva <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace mod_glossary\external; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
@@ -38,10 +28,13 @@ | |
* External function test for delete_entry. | ||
* | ||
* @package mod_glossary | ||
* @category external | ||
* @covers \mod_glossary\external\delete_entry | ||
* @since Moodle 3.10 | ||
* @copyright 2020 Juan Leyva <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class delete_entry_testcase extends externallib_advanced_testcase { | ||
final class delete_entry_test extends externallib_advanced_testcase { | ||
|
||
/** | ||
* Test the behaviour of delete_entry(). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,16 +14,6 @@ | |
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* External function test for prepare_entry. | ||
* | ||
* @package mod_glossary | ||
* @category external | ||
* @since Moodle 3.10 | ||
* @copyright 2020 Juan Leyva <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace mod_glossary\external; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
@@ -38,10 +28,13 @@ | |
* External function test for prepare_entry. | ||
* | ||
* @package mod_glossary | ||
* @category external | ||
* @covers \mod_glossary\external\prepare_entry | ||
* @since Moodle 3.10 | ||
* @copyright 2020 Juan Leyva <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class prepare_entry_testcase extends externallib_advanced_testcase { | ||
final class prepare_entry_test extends externallib_advanced_testcase { | ||
|
||
/** | ||
* test_prepare_entry | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,16 +14,6 @@ | |
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* External function test for update_entry. | ||
* | ||
* @package mod_glossary | ||
* @category external | ||
* @since Moodle 3.10 | ||
* @copyright 2020 Juan Leyva <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace mod_glossary\external; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
@@ -42,10 +32,13 @@ | |
* External function test for update_entry. | ||
* | ||
* @package mod_glossary | ||
* @category external | ||
* @covers \mod_glossary\external\update_entry | ||
* @since Moodle 3.10 | ||
* @copyright 2020 Juan Leyva <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class update_entry_testcase extends externallib_advanced_testcase { | ||
final class update_entry_test extends externallib_advanced_testcase { | ||
|
||
/** | ||
* test_update_entry_without_optional_settings | ||
|
@@ -152,7 +145,7 @@ public function test_update_entry_with_aliases() { | |
$aliases = $DB->get_records('glossary_alias', ['entryid' => $entryid]); | ||
$this->assertCount(2, $aliases); | ||
foreach ($aliases as $alias) { | ||
$this->assertContains($alias->alias, $newaliases); | ||
$this->assertStringContainsString($alias->alias, $newaliases); | ||
} | ||
} | ||
|
||
|
@@ -193,7 +186,7 @@ public function test_update_entry_in_categories() { | |
$categories = $DB->get_records('glossary_entries_categories', ['entryid' => $entryid]); | ||
$this->assertCount(2, $categories); | ||
foreach ($categories as $category) { | ||
$this->assertContains($category->categoryid, $newcategories); | ||
$this->assertStringContainsString($category->categoryid, $newcategories); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,16 +14,6 @@ | |
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* External function test for log_report_viewed. | ||
* | ||
* @package mod_h5pactivity | ||
* @category external | ||
* @since Moodle 3.11 | ||
* @copyright 2021 Ilya Tregubov <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace mod_h5pactivity\external; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
@@ -39,10 +29,14 @@ | |
* External function test for log_report_viewed. | ||
* | ||
* @package mod_h5pactivity | ||
* @category external | ||
* @covers \mod_h5pactivity\external\log_report_viewed | ||
* @since Moodle 3.11 | ||
* @copyright 2021 Ilya Tregubov <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class log_report_viewed_testcase extends externallib_advanced_testcase { | ||
final class log_report_viewed_test extends externallib_advanced_testcase { | ||
|
||
/** | ||
* Test the behaviour of log_report_viewed. | ||
* | ||
|
@@ -110,7 +104,7 @@ public function test_execute(int $enabletracking, int $reviewmode, string $login | |
* | ||
* @return array | ||
*/ | ||
public function execute_data(): array { | ||
public static function execute_data(): array { | ||
return [ | ||
'Student reviewing own attempt' => [ | ||
1, manager::REVIEWCOMPLETION, 'student', 'student' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,31 +14,23 @@ | |
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Unit Tests for a the collection of userlists class | ||
* | ||
* @package core_privacy | ||
* @category test | ||
* @copyright 2018 Andrew Nicols <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
global $CFG; | ||
namespace core_privacy; | ||
|
||
use advanced_testcase; | ||
use \core_privacy\local\request\userlist_collection; | ||
use \core_privacy\local\request\userlist; | ||
use \core_privacy\local\request\approved_userlist; | ||
|
||
/** | ||
* Tests for the \core_privacy API's userlist collection functionality. | ||
* | ||
* @package core_privacy | ||
* @category test | ||
* @copyright 2018 Andrew Nicols <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @coversDefaultClass \core_privacy\local\request\userlist_collection | ||
*/ | ||
class userlist_collection_test extends advanced_testcase { | ||
final class userlist_collection_test extends advanced_testcase { | ||
|
||
/** | ||
* A userlist_collection should support the userlist type. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters