Commit 73f9396e authored by Nathan Lewis's avatar Nathan Lewis Committed by Yuliya Bozhko

Add some data generator funtions to phpunit testing suite (Bug #1307777)

- Replaces require_user and require_test_user with create_test_user
- Added create_test_group and create_test_institution

Change-Id: I8f2acbeef986943cbb4712f47226456fdf3d9570
Signed-off-by: default avatarNathan Lewis <nathan.lewis@totaralms.com>
Signed-off-by: default avatarYuliya Bozhko <yuliya.bozhko@totaralms.com>
parent 63e0484d
This diff is collapsed.
......@@ -20,6 +20,8 @@ require_once(get_config('libroot') . 'view.php');
*/
class ViewTest extends MaharaUnitTest {
/** The id of the user created in setUp. */
private $testuserid;
/** the view created in setUp */
private $view;
/** the id of our shared view. kept for persistency after we delete the view */
......@@ -44,13 +46,13 @@ class ViewTest extends MaharaUnitTest {
*/
public function setUp() {
parent::setUp();
$this->require_test_user();
$this->testuserid = $this->create_test_user();
// set the owner of the view to the test user we created
$this->fields['owner'] = array($this->users['test'], $this->users['test']);
$this->fields['owner'] = array($this->testuserid, $this->testuserid);
$this->view = View::create(array(
'title' => $this->fields['title'][0],
'description' => $this->fields['description'][0],
), $this->users['test']);
), $this->testuserid);
$this->viewid = $this->view->get('id');
}
......@@ -124,7 +126,7 @@ class ViewTest extends MaharaUnitTest {
$todelete = View::create(array(
'title' => $this->fields['title'][0],
'description' => $this->fields['description'][0],
), $this->users['test']);
), $this->testuserid);
$todeleteid = $todelete->get('id');
$todelete->delete();
$todelete->commit();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment