Merge branch 'MDL-65323-master' of https://github.com/snake/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2019-09-18 18:15:19 +02:00
commit 74241346c0
2 changed files with 12 additions and 12 deletions

View File

@ -157,7 +157,7 @@ class favourite_repository_testcase extends advanced_testcase {
$timenow = time(); // Reference only, to check that the created item has a time equal to or greater than this.
$favourites = $favouritesrepo->add_all($favcourses);
$this->assertInternalType('array', $favourites);
$this->assertIsArray($favourites);
$this->assertCount(2, $favourites);
foreach ($favourites as $favourite) {
// Verify we get the favourite back.
@ -304,12 +304,12 @@ class favourite_repository_testcase extends advanced_testcase {
// From the repo, get the list of favourites for the 'core_course/course' area.
$userfavourites = $favouritesrepo->find_by(['component' => 'core_course', 'itemtype' => 'course']);
$this->assertInternalType('array', $userfavourites);
$this->assertIsArray($userfavourites);
$this->assertCount(1, $userfavourites);
// Try to get a list of favourites for a non-existent area.
$userfavourites = $favouritesrepo->find_by(['component' => 'core_cannibalism', 'itemtype' => 'course']);
$this->assertInternalType('array', $userfavourites);
$this->assertIsArray($userfavourites);
$this->assertCount(0, $userfavourites);
}
@ -496,7 +496,7 @@ class favourite_repository_testcase extends advanced_testcase {
$favourite1->ordering = 1;
$favourite1 = $favouritesrepo->update($favourite1);
$this->assertInstanceOf(favourite::class, $favourite1);
$this->assertAttributeEquals('1', 'ordering', $favourite1);
$this->assertEquals('1', $favourite1->ordering);
}
public function test_delete() {

View File

@ -225,14 +225,14 @@ class user_favourite_service_testcase extends advanced_testcase {
// Verify we can get favourites by area.
$favourites = $service->find_favourites_by_type('core_course', 'course');
$this->assertInternalType('array', $favourites);
$this->assertIsArray($favourites);
$this->assertCount(1, $favourites); // We only get favourites for the 'core_course/course' area.
$this->assertAttributeEquals($fav1->id, 'id', $favourites[$fav1->id]);
$this->assertEquals($fav1->id, $favourites[$fav1->id]->id);
$favourites = $service->find_favourites_by_type('core_course', 'anothertype');
$this->assertInternalType('array', $favourites);
$this->assertIsArray($favourites);
$this->assertCount(1, $favourites); // We only get favourites for the 'core_course/course' area.
$this->assertAttributeEquals($fav2->id, 'id', $favourites[$fav2->id]);
$this->assertEquals($fav2->id, $favourites[$fav2->id]->id);
}
/**
@ -252,14 +252,14 @@ class user_favourite_service_testcase extends advanced_testcase {
// Verify find_favourites_by_type only returns results for the user to which the service is scoped.
$user1favourites = $user1service->find_favourites_by_type('core_course', 'course');
$this->assertInternalType('array', $user1favourites);
$this->assertIsArray($user1favourites);
$this->assertCount(1, $user1favourites); // We only get favourites for the 'core_course/course' area for $user1.
$this->assertAttributeEquals($fav1->id, 'id', $user1favourites[$fav1->id]);
$this->assertEquals($fav1->id, $user1favourites[$fav1->id]->id);
$user2favourites = $user2service->find_favourites_by_type('core_course', 'course');
$this->assertInternalType('array', $user2favourites);
$this->assertIsArray($user2favourites);
$this->assertCount(1, $user2favourites); // We only get favourites for the 'core_course/course' area for $user2.
$this->assertAttributeEquals($fav2->id, 'id', $user2favourites[$fav2->id]);
$this->assertEquals($fav2->id, $user2favourites[$fav2->id]->id);
}
/**