Línea 45... |
Línea 45... |
45 |
* @dataProvider get_search_contents_provider
|
45 |
* @dataProvider get_search_contents_provider
|
46 |
* @param array $contentnames The array containing the names of the content that needs to be generated
|
46 |
* @param array $contentnames The array containing the names of the content that needs to be generated
|
47 |
* @param string $search The search string
|
47 |
* @param string $search The search string
|
48 |
* @param array $expected The array containing the expected content names that should be returned by the search
|
48 |
* @param array $expected The array containing the expected content names that should be returned by the search
|
49 |
*/
|
49 |
*/
|
50 |
public function test_get_search_contents(array $contentnames, string $search, array $expected) {
|
50 |
public function test_get_search_contents(array $contentnames, string $search, array $expected): void {
|
51 |
$this->resetAfterTest();
|
51 |
$this->resetAfterTest();
|
Línea 52... |
Línea 52... |
52 |
|
52 |
|
53 |
$admin = get_admin();
|
53 |
$admin = get_admin();
|
54 |
$systemcontext = \context_system::instance();
|
54 |
$systemcontext = \context_system::instance();
|
Línea 137... |
Línea 137... |
137 |
/**
|
137 |
/**
|
138 |
* Test get_search_contents() by searching for content with users that have capability to access/view
|
138 |
* Test get_search_contents() by searching for content with users that have capability to access/view
|
139 |
* all existing content bank content. By default, admins, managers should be able to view every existing content
|
139 |
* all existing content bank content. By default, admins, managers should be able to view every existing content
|
140 |
* that matches the search criteria.
|
140 |
* that matches the search criteria.
|
141 |
*/
|
141 |
*/
|
142 |
public function test_get_search_contents_user_can_access_all_content() {
|
142 |
public function test_get_search_contents_user_can_access_all_content(): void {
|
143 |
$this->resetAfterTest(true);
|
143 |
$this->resetAfterTest(true);
|
Línea 144... |
Línea 144... |
144 |
|
144 |
|
145 |
// Create a course in default category by default.
|
145 |
// Create a course in default category by default.
|
146 |
$course = $this->getDataGenerator()->create_course();
|
146 |
$course = $this->getDataGenerator()->create_course();
|
Línea 181... |
Línea 181... |
181 |
* Test get_search_contents() by searching for content with users that have capability to access/view only
|
181 |
* Test get_search_contents() by searching for content with users that have capability to access/view only
|
182 |
* certain existing content bank content. By default, editing teachers should be able to view content that matches
|
182 |
* certain existing content bank content. By default, editing teachers should be able to view content that matches
|
183 |
* the search criteria AND is in the courses they are enrolled, course categories of the enrolled courses
|
183 |
* the search criteria AND is in the courses they are enrolled, course categories of the enrolled courses
|
184 |
* and system content. Other authenticated users should be able to access only the system content.
|
184 |
* and system content. Other authenticated users should be able to access only the system content.
|
185 |
*/
|
185 |
*/
|
186 |
public function test_get_search_contents_user_can_access_certain_content() {
|
186 |
public function test_get_search_contents_user_can_access_certain_content(): void {
|
187 |
global $CFG;
|
187 |
global $CFG;
|
Línea 188... |
Línea 188... |
188 |
|
188 |
|
Línea 189... |
Línea 189... |
189 |
$this->resetAfterTest(true);
|
189 |
$this->resetAfterTest(true);
|