We've used putenv() to set environment variables in tests forcing us to reload the environment. We don't have to if we use the config helper in Laravel instead.
43 lines
971 B
PHP
43 lines
971 B
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use Tests\TestCase;
|
|
|
|
class InstanceTest extends TestCase
|
|
{
|
|
/**
|
|
* Check if, by default, the disable signups feature is turned off in an
|
|
* instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function test_disable_signup_set_to_false_shows_signup_button()
|
|
{
|
|
config(['monica.disable_signup' => false]);
|
|
|
|
$response = $this->get('/');
|
|
|
|
$response->assertSee(
|
|
'Sign up'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* If an instance sets `disable_signup` env variable to true, it should hide
|
|
* the signup button on the Sign in page.
|
|
* Also, trying to reach `/register` should lead to a 403 page.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function test_disable_signup_set_to_true_hides_signup_button_and_register_page()
|
|
{
|
|
config(['monica.disable_signup' => true]);
|
|
|
|
$response = $this->get('/');
|
|
$response->assertDontSee(
|
|
'Sign up'
|
|
);
|
|
}
|
|
}
|