-
-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1192 from archey347/hotfix-tests
Fix for AccountControllerTest when registration is disabled
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,9 @@ public function testRegisterWithNoMasterUser(AccountController $controller) | |
*/ | ||
public function testRegister() | ||
{ | ||
// Force Registration | ||
$this->ci->config['site.registration.enabled'] = true; | ||
|
||
// Force locale config | ||
$this->ci->config['site.registration.user_defaults.locale'] = 'en_US'; | ||
$this->ci->config['site.locales.available'] = [ | ||
|
@@ -146,6 +149,9 @@ public function testRegister() | |
*/ | ||
public function testRegisterWithNoEmailVerification() | ||
{ | ||
// Force Registration | ||
$this->ci->config['site.registration.enabled'] = true; | ||
|
||
// Delete previous attempt so we can reuse the same shared test code | ||
if ($user = User::where('email', '[email protected]')->first()) { | ||
$user->delete(true); | ||
|
@@ -763,6 +769,12 @@ public function testpageForgotPassword(AccountController $controller) | |
*/ | ||
public function testpageRegister(AccountController $controller) | ||
{ | ||
// Force Registration | ||
$this->ci->config['site.registration.enabled'] = true; | ||
|
||
// Recreate controller to use new config | ||
$controller = $this->getController(); | ||
|
||
$result = $controller->pageRegister($this->getRequest(), $this->getResponse(), []); | ||
$this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $result); | ||
$this->assertSame($result->getStatusCode(), 200); | ||
|
@@ -793,6 +805,7 @@ public function testpageRegisterWithNoLocales() | |
{ | ||
// Force config | ||
$this->ci->config['site.locales.available'] = []; | ||
$this->ci->config['site.registration.enabled'] = true; | ||
|
||
// Recreate controller to use new config | ||
$controller = $this->getController(); | ||
|
@@ -809,6 +822,9 @@ public function testpageRegisterWithNoLocales() | |
*/ | ||
public function testpageRegisterWithLoggedInUser() | ||
{ | ||
// Force Config | ||
$this->ci->config['site.registration.enabled'] = true; | ||
|
||
// Create a test user | ||
$testUser = $this->createTestUser(false, true); | ||
|
||
|
@@ -1179,6 +1195,9 @@ public function testRegisterWithLoggedInUser() | |
*/ | ||
public function testRegisterWithFailedThrottle() | ||
{ | ||
// Force config | ||
$this->ci->config['site.registration.enabled'] = true; | ||
|
||
// Create fake throttler | ||
$throttler = m::mock(Throttler::class); | ||
$throttler->shouldReceive('getDelay')->once()->with('registration_attempt')->andReturn(90); | ||
|
@@ -1211,6 +1230,12 @@ public function testRegisterWithFailedThrottle() | |
*/ | ||
public function testRegisterWithFailedCaptcha(AccountController $controller) | ||
{ | ||
// Force config | ||
$this->ci->config['site.registration.enabled'] = true; | ||
|
||
// Recreate controller with new config | ||
$controller = $this->getController(); | ||
|
||
// Bypass security feature | ||
$fm = $this->ci->factory; | ||
$dummyUser = $fm->create(User::class); | ||
|
@@ -1240,6 +1265,12 @@ public function testRegisterWithFailedCaptcha(AccountController $controller) | |
*/ | ||
public function testRegisterWithFailedValidation(AccountController $controller) | ||
{ | ||
// Force config | ||
$this->ci->config['site.registration.enabled'] = true; | ||
|
||
// Recreate controller with new config | ||
$controller = $this->getController(); | ||
|
||
// Bypass security feature | ||
$fm = $this->ci->factory; | ||
$dummyUser = $fm->create(User::class); | ||
|