MDL-86283 courseformat: Correct overview erroneous coverage
Co-Authored-By: Andrew Nicols <[email protected]>
This commit is contained in:
@@ -16,8 +16,6 @@
|
||||
|
||||
namespace core_courseformat;
|
||||
|
||||
use core_courseformat\local\overview\overviewfactory;
|
||||
|
||||
/**
|
||||
* Tests for course
|
||||
*
|
||||
@@ -25,8 +23,8 @@ use core_courseformat\local\overview\overviewfactory;
|
||||
* @category test
|
||||
* @copyright 2025 Ferran Recio <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_courseformat\activityoverviewbase
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(activityoverviewbase::class)]
|
||||
final class activityoverviewbase_test extends \advanced_testcase {
|
||||
#[\Override()]
|
||||
public static function setUpBeforeClass(): void {
|
||||
@@ -39,8 +37,6 @@ final class activityoverviewbase_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test get_name_overview method.
|
||||
*
|
||||
* @covers ::get_name_overview
|
||||
*/
|
||||
public function test_get_name_overview(): void {
|
||||
$this->resetAfterTest();
|
||||
@@ -63,10 +59,9 @@ final class activityoverviewbase_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test get_completion_overview method.
|
||||
*
|
||||
* @covers ::get_completion_overview
|
||||
* @dataProvider provider_get_completion_overview
|
||||
* @param int $setcompletion the completion status
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\DataProvider('provider_get_completion_overview')]
|
||||
public function test_get_completion_overview(
|
||||
int $setcompletion,
|
||||
): void {
|
||||
@@ -136,8 +131,6 @@ final class activityoverviewbase_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test get_completion_overview method on an activity with no completion.
|
||||
*
|
||||
* @covers ::get_completion_overview
|
||||
*/
|
||||
public function test_get_completion_overview_no_completion(): void {
|
||||
$this->resetAfterTest();
|
||||
@@ -172,8 +165,6 @@ final class activityoverviewbase_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test get_grades_overviews method.
|
||||
*
|
||||
* @covers ::get_grades_overviews
|
||||
*/
|
||||
public function test_get_grades_overviews(): void {
|
||||
$this->resetAfterTest();
|
||||
@@ -280,8 +271,6 @@ final class activityoverviewbase_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test get_grades_overviews method.
|
||||
*
|
||||
* @covers ::get_grades_overviews
|
||||
*/
|
||||
public function test_get_grades_overviews_hidden(): void {
|
||||
$this->resetAfterTest();
|
||||
@@ -332,14 +321,13 @@ final class activityoverviewbase_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test needs_filtering_by_groups method.
|
||||
*
|
||||
* @covers ::needs_filtering_by_groups
|
||||
* @dataProvider provider_needs_filtering_by_groups
|
||||
*
|
||||
* @param string $role of the user to test
|
||||
* @param int $groupmode of the activity to test
|
||||
* @param bool $expected result.
|
||||
* @return void
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\DataProvider('provider_needs_filtering_by_groups')]
|
||||
public function test_needs_filtering_by_groups(string $role, int $groupmode, bool $expected): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -414,14 +402,12 @@ final class activityoverviewbase_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test needs_filtering_by_groups method.
|
||||
*
|
||||
* @covers ::get_groups_for_filtering
|
||||
* @dataProvider provider_get_groups_for_filtering
|
||||
*
|
||||
* @param string $role of the user to test
|
||||
* @param int $groupmode of the activity to test
|
||||
* @param array $expected result
|
||||
* @return void
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\DataProvider('provider_get_groups_for_filtering')]
|
||||
public function test_get_groups_for_filtering(string $role, int $groupmode, array $expected): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -512,14 +498,13 @@ final class activityoverviewbase_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test has_error method.
|
||||
*
|
||||
* @covers ::has_error
|
||||
* @dataProvider provider_has_error
|
||||
*
|
||||
* @param string $role of the user to test
|
||||
* @param int $groupmode of the activity to test
|
||||
* @param bool $expected result
|
||||
* @return void
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\DataProvider('provider_has_error')]
|
||||
public function test_has_error(string $role, int $groupmode, bool $expected): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace core_courseformat\external;
|
||||
* @category test
|
||||
* @copyright 2025 Ferran Recio <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_courseformat\external\activityname_exporter
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(activityname_exporter::class)]
|
||||
final class activityname_exporter_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test export method.
|
||||
|
||||
@@ -26,8 +26,8 @@ use stdClass;
|
||||
* @category test
|
||||
* @copyright 2025 Ferran Recio <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_courseformat\external\get_overview_information
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(get_overview_information::class)]
|
||||
final class get_overview_information_test extends \core_external\tests\externallib_testcase {
|
||||
public function test_get_overview_information(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -25,8 +25,8 @@ use core_courseformat\output\local\overview\overviewdialog;
|
||||
* @category test
|
||||
* @copyright 2025 Ferran Recio <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_courseformat\external\overviewdialog_exporter
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(overviewdialog_exporter::class)]
|
||||
final class overviewdialog_exporter_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test export method.
|
||||
|
||||
@@ -26,8 +26,8 @@ use core_courseformat\local\overview\overviewitem;
|
||||
* @category test
|
||||
* @copyright 2025 Ferran Recio <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_courseformat\external\overviewitem_exporter
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(overviewitem_exporter::class)]
|
||||
final class overviewitem_exporter_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test export with basic content.
|
||||
|
||||
@@ -25,8 +25,8 @@ use core_courseformat\output\local\overview\overviewtable;
|
||||
* @category test
|
||||
* @copyright 2025 Ferran Recio <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_courseformat\external\overviewtable_exporter
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(overviewtable_exporter::class)]
|
||||
final class overviewtable_exporter_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test export method.
|
||||
|
||||
@@ -23,10 +23,10 @@ namespace core_courseformat\local\overview;
|
||||
* @category test
|
||||
* @copyright 2025 Ferran Recio <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_courseformat\local\overview\overviewfactory
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(overviewfactory::class)]
|
||||
final class overviewfactory_test extends \advanced_testcase {
|
||||
#[\Override()]
|
||||
#[\Override]
|
||||
public static function setUpBeforeClass(): void {
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/course/format/tests/fixtures/wrongcm_activityoverview.php');
|
||||
@@ -36,9 +36,9 @@ final class overviewfactory_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test create method on resource activities.
|
||||
*
|
||||
* @dataProvider create_resource_provider
|
||||
* @param string $resourcetype
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\DataProvider('create_resource_provider')]
|
||||
public function test_create_resource(
|
||||
string $resourcetype,
|
||||
?string $expected,
|
||||
@@ -149,8 +149,7 @@ final class overviewfactory_test extends \advanced_testcase {
|
||||
];
|
||||
}
|
||||
|
||||
public function test_create_exception(
|
||||
): void {
|
||||
public function test_create_exception(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -178,10 +177,10 @@ final class overviewfactory_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test activity_has_overview_integration for existing modules.
|
||||
*
|
||||
* @dataProvider activity_has_overview_integration_provider
|
||||
* @param string $modname
|
||||
* @param bool $hasintegration
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\DataProvider('activity_has_overview_integration_provider')]
|
||||
public function test_activity_has_overview_integration(
|
||||
string $modname,
|
||||
bool $hasintegration,
|
||||
|
||||
@@ -25,19 +25,11 @@ use core\output\local\properties\text_align;
|
||||
* @category test
|
||||
* @copyright 2025 Ferran Recio <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_courseformat\local\overview\overviewitem
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(overviewitem::class)]
|
||||
final class overviewitem_test extends \advanced_testcase {
|
||||
/**
|
||||
* Tests the constructor.
|
||||
*
|
||||
* @covers ::__construct
|
||||
* @covers ::get_name
|
||||
* @covers ::get_value
|
||||
* @covers ::get_content
|
||||
* @covers ::get_text_align
|
||||
* @covers ::get_alert_count
|
||||
* @covers ::get_alert_label
|
||||
*/
|
||||
public function test_constructor(): void {
|
||||
$name = 'Activity name';
|
||||
@@ -65,19 +57,6 @@ final class overviewitem_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test chained setters.
|
||||
*
|
||||
* @covers ::set_name
|
||||
* @covers ::set_value
|
||||
* @covers ::set_content
|
||||
* @covers ::set_text_align
|
||||
* @covers ::set_alert_count
|
||||
* @covers ::set_alert_label
|
||||
* @covers ::get_name
|
||||
* @covers ::get_value
|
||||
* @covers ::get_content
|
||||
* @covers ::get_text_align
|
||||
* @covers ::get_alert_count
|
||||
* @covers ::get_alert_label
|
||||
*/
|
||||
public function test_setters(): void {
|
||||
$item = new overviewitem('Sample', 1, 'Content', text_align::CENTER, 1, 'Alert label');
|
||||
|
||||
@@ -23,20 +23,18 @@ namespace core_courseformat\local\overview;
|
||||
* @category test
|
||||
* @copyright 2025 Ferran Recio <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_courseformat\local\overview\resourceoverview
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(resourceoverview::class)]
|
||||
final class resourceoverview_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test get_actions_overview.
|
||||
*
|
||||
* @covers ::get_actions_overview
|
||||
* @dataProvider provider_test_get_actions_overview
|
||||
*
|
||||
* @param string $role The role of the user to test.
|
||||
* @param string $resourcetype The type of resource to create.
|
||||
* @param array|null $expected Expected overview item data.
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\DataProvider('provider_test_get_actions_overview')]
|
||||
public function test_get_actions_overview(
|
||||
string $role,
|
||||
string $resourcetype,
|
||||
@@ -133,8 +131,6 @@ final class resourceoverview_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test get_extra_overview_items method.
|
||||
*
|
||||
* @covers ::get_extra_overview_items
|
||||
*/
|
||||
public function test_get_extra_overview_items(): void {
|
||||
$this->resetAfterTest();
|
||||
@@ -168,12 +164,10 @@ final class resourceoverview_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test get_extra_type_overview method.
|
||||
*
|
||||
* @covers ::get_extra_overview_items
|
||||
* @covers ::get_extra_type_overview
|
||||
* @dataProvider get_extra_type_overview_provider
|
||||
* @param string $resourcetype
|
||||
* @param string|null $expected
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\DataProvider('get_extra_type_overview_provider')]
|
||||
public function test_get_extra_type_overview(
|
||||
string $resourcetype,
|
||||
?string $expected,
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace core_courseformat\output\local\overview;
|
||||
* @category test
|
||||
* @copyright 2025 Ferran Recio <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_courseformat\output\local\overview\activityname
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(activityname::class)]
|
||||
final class activityname_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the exportable interface implementation.
|
||||
|
||||
@@ -23,17 +23,16 @@ namespace core_courseformat\output\local\overview;
|
||||
* @category test
|
||||
* @copyright 2025 Ferran Recio <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_courseformat\output\local\overview\missingoverviewnotice
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(missingoverviewnotice::class)]
|
||||
final class missingoverviewnotice_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test overview integrations.
|
||||
*
|
||||
* @covers ::export_for_template
|
||||
* @dataProvider overview_integrations_provider
|
||||
* @param string $modname
|
||||
* @param bool $expectempty
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\DataProvider('overview_integrations_provider')]
|
||||
public function test_overview_integrations(
|
||||
string $modname,
|
||||
bool $expectempty,
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace core_courseformat\output\local\overview;
|
||||
* @category test
|
||||
* @copyright 2025 Ferran Recio <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_courseformat\output\local\overview\overviewdialog
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(overviewdialog::class)]
|
||||
final class overviewdialog_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the exportable interface implementation.
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace core_courseformat\output\local\overview;
|
||||
* @category test
|
||||
* @copyright 2025 Ferran Recio <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_courseformat\output\local\overview\overviewtable
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(overviewtable::class)]
|
||||
final class overviewtable_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test export_for_external method.
|
||||
|
||||
Reference in New Issue
Block a user