Skip to content

Commit

Permalink
phpcs: setUp methods in tests must call parent
Browse files Browse the repository at this point in the history
  • Loading branch information
jrchamp committed Jul 3, 2024
1 parent ad9eca5 commit b6df07b
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,8 @@ function xmldb_zoom_upgrade($oldversion) {
$occurrences = $DB->get_records('zoom_meeting_details');

foreach ($occurrences as $occurrence) {
$DB->set_field_select('zoom_meeting_details', 'duration', $occurrence->end_time - $occurrence->start_time, 'id = ?', [$occurrence->id]);
$duration = $occurrence->end_time - $occurrence->start_time;
$DB->set_field_select('zoom_meeting_details', 'duration', $duration, 'id = ?', [$occurrence->id]);
}

// Zoom savepoint reached.
Expand Down
1 change: 0 additions & 1 deletion lang/en/zoom.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +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/>.


/**
* English strings for zoom.
*
Expand Down
1 change: 1 addition & 0 deletions tests/advanced_passcode_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static function assertMatchesRegularExpression($pattern, $string, $messag
public static function setUpBeforeClass(): void {
global $CFG;
require_once($CFG->dirroot . '/mod/zoom/locallib.php');
parent::setUpBeforeClass();
}

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/error_handling_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ final class error_handling_test extends basic_testcase {
public static function setUpBeforeClass(): void {
global $CFG;
require_once($CFG->dirroot . '/mod/zoom/locallib.php');
parent::setUpBeforeClass();
}

/**
* Setup before every test.
*/
public function setUp(): void {
parent::setUp();
$this->meetingnotfoundexception = new not_found_exception('meeting not found', 3001);
$this->usernotfoundexception = new not_found_exception('user not found', 1001);
$this->invaliduserexception = new not_found_exception('invalid user found', 1120);
Expand Down
4 changes: 3 additions & 1 deletion tests/get_meeting_reports_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public function mock_get_meeting_participants($meetinguuid, $webinar) {
* Setup.
*/
public function setUp(): void {
parent::setUp();

$this->resetAfterTest(true);

$this->meetingtask = new \mod_zoom\task\get_meeting_reports();
Expand Down Expand Up @@ -380,7 +382,7 @@ public function test_normalize_meeting(): void {
// Try duration under an hour.
$dashboardmeeting['duration'] = '10:01';
$meeting = $this->meetingtask->normalize_meeting((object) $dashboardmeeting);
$this->assertEquals($meeting->duration, 10 * 60 + 1);
$this->assertEquals($meeting->duration, 10 * 60 + 1);

$reportmeeting = [
'uuid' => 'sfsdfsdfc6122222d',
Expand Down
2 changes: 2 additions & 0 deletions tests/mod_zoom_grade_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ public static function setUpBeforeClass(): void {
global $CFG;
require_once($CFG->dirroot . '/mod/zoom/lib.php');
require_once($CFG->dirroot . '/mod/zoom/locallib.php');
parent::setUpBeforeClass();
}

/**
* Setup before every test.
*/
public function setUp(): void {
parent::setUp();
$this->resetAfterTest();
$this->setAdminUser();

Expand Down
2 changes: 2 additions & 0 deletions tests/mod_zoom_invitation_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ final class mod_zoom_invitation_test extends advanced_testcase {
public static function setUpBeforeClass(): void {
global $CFG;
require_once($CFG->libdir . '/accesslib.php');
parent::setUpBeforeClass();
}

/**
* Run before every test.
*/
protected function setUp(): void {
parent::setUp();
set_config('invitationregexenabled', 1, 'zoom');
}

Expand Down
2 changes: 2 additions & 0 deletions tests/mod_zoom_webservice_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ final class mod_zoom_webservice_test extends advanced_testcase {
public static function setUpBeforeClass(): void {
global $CFG;
require_once($CFG->dirroot . '/mod/zoom/locallib.php');
parent::setUpBeforeClass();
}

/**
* Setup before every test.
*/
public function setUp(): void {
parent::setUp();
$this->resetAfterTest();
// Set fake values so we can test methods in class.
set_config('clientid', 'test', 'zoom');
Expand Down
1 change: 1 addition & 0 deletions tests/privacy/mod_zoom_provider_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ final class mod_zoom_provider_test extends provider_testcase {
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->resetAfterTest();
$this->setAdminUser();

Expand Down

0 comments on commit b6df07b

Please sign in to comment.