Skip to content

Commit

Permalink
modified behat and phpunit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
irinahpe committed Feb 2, 2024
1 parent 3095c7d commit 440d181
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 22 deletions.
1 change: 0 additions & 1 deletion mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ private function get_settingsfield_identifier($strategy, $key) {
*/
public function add_completion_rules() {
$mform = $this->_form;
$suffix = $this->get_suffix();

$mform->addElement('advcheckbox', $this->get_suffixed_name('vote'), ' ', get_string('completionvote', RATINGALLOCATE_MOD_NAME));
$mform->addElement('advcheckbox', $this->get_suffixed_name('allocation'), ' ', get_string('completionallocation', RATINGALLOCATE_MOD_NAME));
Expand Down
9 changes: 2 additions & 7 deletions tests/behat/completion_condition_allocation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@ Feature: Set a ratingallocate activity marked as completed when a user has been
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name |
| ratingallocate | C1 | ra1 | My Fair Allocation |
And I am on the "My Fair Allocation" "ratingallocate activity editing" page
And I expand "Completion conditions" node
And I select the radio "id_completion_2"
And I check "id_completionallocation"
And I press "id_submitbutton"
| activity | course | idnumber | name | completion | completionallocation |
| ratingallocate | C1 | ra1 | My Fair Allocation | 2 | 1 |
And the following choices exist:
| title | explanation | maxsize | ratingallocate |
| C1 | Test | 1 | My Fair Allocation |
Expand Down
9 changes: 2 additions & 7 deletions tests/behat/completion_condition_vote.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,15 @@ Feature: Set a ratingallocate activity marked as completed when a user submits a
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name |
| ratingallocate | C1 | ra1 | My Fair Allocation |
| activity | course | idnumber | name | completion | completionvote |
| ratingallocate | C1 | ra1 | My Fair Allocation | 2 | 1 |
And I log in as "teacher1"
And I am on the "My Fair Allocation" "ratingallocate activity" page
And I press "Edit Choices"
And I add a new choice with the values:
| title | My first choice |
| Description (optional) | Test 1 |
| maxsize | 2 |
And I am on the "My Fair Allocation" "ratingallocate activity editing" page
And I expand "Completion conditions" node
And I select the radio "id_completion_2"
And I check "id_completionvote"
And I press "id_submitbutton"

@javascript
Scenario: User completes ratingallocate only if they voted
Expand Down
8 changes: 2 additions & 6 deletions tests/behat/completion_manual.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@ Feature: Manually mark a ratingallocate activity as completed
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name |
| ratingallocate | C1 | ra1 | My Fair Allocation |
| activity | course | idnumber | name | completion |
| ratingallocate | C1 | ra1 | My Fair Allocation | 1 |
And I log in as "teacher1"
And I am on the "My Fair Allocation" "ratingallocate activity" page
And I press "Edit Choices"
And I add a new choice with the values:
| title | My first choice |
| Description (optional) | Test 1 |
| maxsize | 2 |
And I am on the "My Fair Allocation" "ratingallocate activity editing" page
And I expand "Completion conditions" node
And I select the radio "id_completion_1"
And I press "id_submitbutton"

@javascript
Scenario: Use manual completion
Expand Down
4 changes: 3 additions & 1 deletion tests/mod_generator_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ public function test_create_instance() {
'notificationsend' => '0',
'algorithmstarttime' => null,
'algorithmstatus' => '0',
'runalgorithmbycron' => '1'
'runalgorithmbycron' => '1',
'completionvote' => '0',
'completionallocation' => '0'
);

$this->assertEquals(json_decode(json_encode($expectedvaluesdb, false)), reset($records));
Expand Down

0 comments on commit 440d181

Please sign in to comment.