MDL-62140 core_privacy: only reset tests when necessary
authorMark Nelson <markn@moodle.com>
Tue, 24 Apr 2018 02:54:21 +0000 (10:54 +0800)
committerMark Nelson <markn@moodle.com>
Tue, 24 Apr 2018 02:54:21 +0000 (10:54 +0800)
privacy/tests/contextlist_test.php

index 5f4d2ef..35bf88c 100644 (file)
@@ -37,13 +37,6 @@ use \core_privacy\local\request\contextlist;
  */
 class contextlist_test extends advanced_testcase {
 
-    /**
-     * Runs before each test is performed.
-     */
-    public function setUp() {
-        $this->resetAfterTest();
-    }
-
     /**
      * Ensure that valid SQL results in the relevant contexts being added.
      */
@@ -78,6 +71,8 @@ class contextlist_test extends advanced_testcase {
      * Ensure that a valid user context id is added.
      */
     public function test_add_user_context() {
+        $this->resetAfterTest();
+
         $user = $this->getDataGenerator()->create_user();
 
         $cl = new contextlist();
@@ -94,6 +89,8 @@ class contextlist_test extends advanced_testcase {
      * Ensure that valid user contexts are added.
      */
     public function test_add_user_contexts() {
+        $this->resetAfterTest();
+
         $user1 = $this->getDataGenerator()->create_user();
         $user2 = $this->getDataGenerator()->create_user();