Skip to content

Commit

Permalink
MDL-41026 webservices: Correct unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jan 28, 2015
1 parent be15d38 commit 60d8078
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions notes/tests/externallib_test.php
Expand Up @@ -100,15 +100,15 @@ public function test_delete_notes() {
$creatednotes = core_notes_external::create_notes($cnotes);
$creatednotes = external_api::clean_returnvalue(core_notes_external::create_notes_returns(), $creatednotes);

$dnotes1 = array("notes"=>array($creatednotes[0]['noteid']));
$dnotes1 = array($creatednotes[0]['noteid']);
$deletednotes1 = core_notes_external::delete_notes($dnotes1);
$deletednotes1 = external_api::clean_returnvalue(core_notes_external::delete_notes_returns(), $deletednotes1);

// Confirm that base note data was deleted correctly.
$notdeletedcount = $DB->count_records_select('post', 'id = ' . $creatednotes[0]['noteid']);
$this->assertEquals(0, $notdeletedcount);

$dnotes2 = array("notes"=>array(33)); // This note does not exist.
$dnotes2 = array(33); // This note does not exist.
$deletednotes2 = core_notes_external::delete_notes($dnotes2);
$deletednotes2 = external_api::clean_returnvalue(core_notes_external::delete_notes_returns(), $deletednotes2);

Expand All @@ -119,7 +119,7 @@ public function test_delete_notes() {

// Call without required capability.
$creatednotes = core_notes_external::create_notes($cnotes);
$dnotes3 = array("notes"=>array($creatednotes[0]['noteid']));
$dnotes3 = array($creatednotes[0]['noteid']);

$this->unassignUserCapability('moodle/notes:manage', $contextid, $roleid);
$this->setExpectedException('required_capability_exception');
Expand Down Expand Up @@ -157,7 +157,7 @@ public function test_get_notes() {
$creatednotes3 = external_api::clean_returnvalue(core_notes_external::create_notes_returns(), $creatednotes3);

// Note 33 does not exist.
$gnotes = array("notes"=>array($creatednotes1[0]['noteid'], $creatednotes2[0]['noteid'], $creatednotes3[0]['noteid'], 33));
$gnotes = array($creatednotes1[0]['noteid'], $creatednotes2[0]['noteid'], $creatednotes3[0]['noteid'], 33);
$getnotes = core_notes_external::get_notes($gnotes);
$getnotes = external_api::clean_returnvalue(core_notes_external::get_notes_returns(), $getnotes);

Expand Down

0 comments on commit 60d8078

Please sign in to comment.