Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/testing/PhabricatorTestCase.php
| Show First 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | protected function generateNewTestUser() { | ||||
| $email = id(new PhabricatorUserEmail()) | $email = id(new PhabricatorUserEmail()) | ||||
| ->setAddress("testuser{$seed}@example.com") | ->setAddress("testuser{$seed}@example.com") | ||||
| ->setIsVerified(1); | ->setIsVerified(1); | ||||
| $editor = new PhabricatorUserEditor(); | $editor = new PhabricatorUserEditor(); | ||||
| $editor->setActor($user); | $editor->setActor($user); | ||||
| $editor->createNewUser($user, $email); | $editor->createNewUser($user, $email); | ||||
| // When creating a new test user, we prefill their setting cache as empty. | |||||
| // This is a little more efficient than doing a query to load the empty | |||||
| // settings. | |||||
| $user->attachRawCacheData( | |||||
| array( | |||||
| PhabricatorUserPreferencesCacheType::KEY_PREFERENCES => '[]', | |||||
| )); | |||||
| return $user; | return $user; | ||||
| } | } | ||||
| /** | /** | ||||
| * Throws unless tests are currently executing. This method can be used to | * Throws unless tests are currently executing. This method can be used to | ||||
| * guard code which is specific to unit tests and should not normally be | * guard code which is specific to unit tests and should not normally be | ||||
| * reachable. | * reachable. | ||||
| Show All 27 Lines | |||||