MDL-63658 core_favourites: fix errors discovered on oracle db
- Assuming 1 would be a record that didn't exist. should be using 0. - Missing space before AND in sql in provider.
This commit is contained in:
@@ -87,7 +87,7 @@ class provider implements \core_privacy\local\metadata\provider, \core_privacy\l
|
||||
WHERE userid = :userid
|
||||
AND component = :component";
|
||||
if (!is_null($itemtype)) {
|
||||
$sql .= "AND itemtype = :itemtype";
|
||||
$sql .= " AND itemtype = :itemtype";
|
||||
}
|
||||
$params = ['userid' => $userid, 'component' => $component, 'itemtype' => $itemtype];
|
||||
$contextlist->add_from_sql($sql, $params);
|
||||
|
||||
@@ -201,7 +201,7 @@ class favourite_repository_testcase extends advanced_testcase {
|
||||
// Try to get a favourite we know doesn't exist.
|
||||
// We expect an exception in this case.
|
||||
$this->expectException(dml_exception::class);
|
||||
$favouritesrepo->find(1);
|
||||
$favouritesrepo->find(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -414,7 +414,7 @@ class favourite_repository_testcase extends advanced_testcase {
|
||||
$this->assertTrue($favouritesrepo->exists($createdfavourite->id));
|
||||
|
||||
// Verify exists returns false for non-existent favourite.
|
||||
$this->assertFalse($favouritesrepo->exists(1));
|
||||
$this->assertFalse($favouritesrepo->exists(0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user