/** * Tests that the function returns true when the number of previous resources is higher than the minumimum defined, * i.e., the input is ABOVE the lower limit of the input domain. In this case, since the input domain only has a limit, * the lower one, the input is also INSIDE. */ public function test_meets_minimum_resources_above() { $this->resetAfterTest(); $this->setAdminUser(); // The course will meet the minimum previous resources, so, we expect a true from the function. $expected = true; // We stablish a value that is inside the input domain. $numberofresources = course_filter::MINIMUM_PREVIOUS_RESOURCES + 1; // We have to creates some courses before creating resources, with the attributes defined in setUp. $numberofcoursestocreate = course_filter::MINIMUM_PREVIOUS_COURSES; $previouscourses = $this->create_courses($this->previouscourseattributes, $numberofcoursestocreate); $previouscoursesids = $this->insert_previous_courses_in_historic_data($previouscourses); // We divide the resources to create in, let's say, 3 types of resources, to have a bit of variation. $previousresources = array(); $previousresources[$previouscourses[0]->id]['mod_page'] = $numberofresources / 3; $previousresources[$previouscourses[0]->id]['mod_url'] = $numberofresources / 3; $previousresources[$previouscourses[0]->id]['mod_book'] = $numberofresources / 3; $resources = $this->create_resources($previousresources); $this->insert_previous_resources_in_historic_data($resources, $previouscoursesids[0]); // We get the actual value and we do the assertion. $currentcourseid = $this->currentcourse[0]->id; $actual = course_filter::meets_minimum_resources($currentcourseid, $this->currentyear, $this->db); $this->assertEquals($expected, $actual); }