Skip to content

Commit

Permalink
MDL-68341 core_table: improve fetch WS php unit coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Apr 21, 2020
1 parent 4cf97b7 commit ad176d6
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion lib/table/tests/external/dynamic/fetch_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,26 @@ public static function setUpBeforeClass(): void {
require_once("{$CFG->libdir}/externallib.php");
}

/**
* Test execute invalid component format.
*/
public function test_execute_invalid_component_format(): void {
$this->resetAfterTest();

$this->expectException(\invalid_parameter_exception::class);
fetch::execute("core-user", "participants", "", "email", "4", [], "1");
}

/**
* Test execute invalid component.
*/
public function test_execute_invalid_component(): void {
$this->resetAfterTest();

$this->expectException(\UnexpectedValueException::class);
fetch::execute("core_users", "participants", "", "email", "4", [], "1");
}

/**
* Test execute invalid handler.
*/
Expand Down Expand Up @@ -78,7 +98,7 @@ public function test_execute_invalid_filter(): void {
'values' => [(int)$course->id]
]
];
$this->expectException('invalid_parameter_exception');
$this->expectException(\invalid_parameter_exception::class);
$this->expectExceptionMessage("Invalid parameter value detected (filters => Invalid parameter value detected " .
"(Missing required key in single structure: name): Missing required key in single structure: name");

Expand Down

0 comments on commit ad176d6

Please sign in to comment.