fix tests of SetupController
This commit is contained in:
parent
3143cf0838
commit
b1974ffafd
|
|
@ -46,59 +46,59 @@ class SetupControllerTest extends TestCase
|
||||||
$server = "{$config['username']}@{$config['host']}";
|
$server = "{$config['username']}@{$config['host']}";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->visit('/setup')->see($type)->see($server);
|
$this->get('/setup')->assertSee($type)->assertSee($server);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInfo()
|
public function testInfo()
|
||||||
{
|
{
|
||||||
$this->visit('/setup/info')
|
$this->get('/setup/info')
|
||||||
->seePageIs('/setup/info');
|
->assertViewIs('setup.wizard.info');
|
||||||
|
|
||||||
Artisan::call('migrate:refresh');
|
Artisan::call('migrate:refresh');
|
||||||
Schema::drop('users');
|
Schema::drop('users');
|
||||||
$this->visit('/setup/info')->see('already exist');
|
$this->get('/setup/info')->assertSee('already exist');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFinish()
|
public function testFinish()
|
||||||
{
|
{
|
||||||
// Without `email` field
|
// Without `email` field
|
||||||
$this->post('/setup/finish')
|
$this->post('/setup/finish')
|
||||||
->dontSee(trans('setup.wizard.finish.title'));
|
->assertDontSee(trans('setup.wizard.finish.title'));
|
||||||
|
|
||||||
// Not an valid email address
|
// Not an valid email address
|
||||||
$this->post('/setup/finish', ['email' => 'not_an_email'])
|
$this->post('/setup/finish', ['email' => 'not_an_email'])
|
||||||
->dontSee(trans('setup.wizard.finish.title'));
|
->assertDontSee(trans('setup.wizard.finish.title'));
|
||||||
|
|
||||||
// Without `password` field
|
// Without `password` field
|
||||||
$this->post('/setup/finish', [
|
$this->post('/setup/finish', [
|
||||||
'email' => 'a@b.c'
|
'email' => 'a@b.c'
|
||||||
])->dontSee(trans('setup.wizard.finish.title'));
|
])->assertDontSee(trans('setup.wizard.finish.title'));
|
||||||
|
|
||||||
// Password is too short
|
// Password is too short
|
||||||
$this->post('/setup/finish', [
|
$this->post('/setup/finish', [
|
||||||
'email' => 'a@b.c',
|
'email' => 'a@b.c',
|
||||||
'password' => '1'
|
'password' => '1'
|
||||||
])->dontSee(trans('setup.wizard.finish.title'));
|
])->assertDontSee(trans('setup.wizard.finish.title'));
|
||||||
|
|
||||||
// Password is too long
|
// Password is too long
|
||||||
$this->post('/setup/finish', [
|
$this->post('/setup/finish', [
|
||||||
'email' => 'a@b.c',
|
'email' => 'a@b.c',
|
||||||
'password' => str_random(17)
|
'password' => str_random(17)
|
||||||
])->dontSee(trans('setup.wizard.finish.title'));
|
])->assertDontSee(trans('setup.wizard.finish.title'));
|
||||||
|
|
||||||
// Confirmation is not OK
|
// Confirmation is not OK
|
||||||
$this->post('/setup/finish', [
|
$this->post('/setup/finish', [
|
||||||
'email' => 'a@b.c',
|
'email' => 'a@b.c',
|
||||||
'password' => '12345678',
|
'password' => '12345678',
|
||||||
'password_confirmation' => '12345679'
|
'password_confirmation' => '12345679'
|
||||||
])->dontSee(trans('setup.wizard.finish.title'));
|
])->assertDontSee(trans('setup.wizard.finish.title'));
|
||||||
|
|
||||||
// Without `site_name` field
|
// Without `site_name` field
|
||||||
$this->post('/setup/finish', [
|
$this->post('/setup/finish', [
|
||||||
'email' => 'a@b.c',
|
'email' => 'a@b.c',
|
||||||
'password' => '12345678',
|
'password' => '12345678',
|
||||||
'password_confirmation' => '12345678'
|
'password_confirmation' => '12345678'
|
||||||
])->dontSee(trans('setup.wizard.finish.title'));
|
])->assertDontSee(trans('setup.wizard.finish.title'));
|
||||||
|
|
||||||
// Regenerate keys
|
// Regenerate keys
|
||||||
Artisan::shouldReceive('call')
|
Artisan::shouldReceive('call')
|
||||||
|
|
@ -122,19 +122,19 @@ class SetupControllerTest extends TestCase
|
||||||
'password_confirmation' => '12345678',
|
'password_confirmation' => '12345678',
|
||||||
'site_name' => 'bs',
|
'site_name' => 'bs',
|
||||||
'generate_random' => true
|
'generate_random' => true
|
||||||
])->see(trans('setup.wizard.finish.title'))
|
])->assertSee(trans('setup.wizard.finish.title'))
|
||||||
->see('a@b.c')
|
->assertSee('a@b.c')
|
||||||
->see('12345678');
|
->assertSee('12345678');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUpdate()
|
public function testUpdate()
|
||||||
{
|
{
|
||||||
$this->visit('/setup/update')
|
$this->get('/setup/update')
|
||||||
->see(trans('setup.locked.text'));
|
->assertSee(trans('setup.locked.text'));
|
||||||
|
|
||||||
option(['version' => '0.1.0']);
|
option(['version' => '0.1.0']);
|
||||||
$this->visit('/setup/update')
|
$this->get('/setup/update')
|
||||||
->see(trans('setup.updates.welcome.title'));
|
->assertSee(trans('setup.updates.welcome.title'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDoUpdate()
|
public function testDoUpdate()
|
||||||
|
|
@ -150,8 +150,7 @@ class SetupControllerTest extends TestCase
|
||||||
->with('view:clear')
|
->with('view:clear')
|
||||||
->andThrow(new Exception());
|
->andThrow(new Exception());
|
||||||
config(['options.new_option' => 'value']);
|
config(['options.new_option' => 'value']);
|
||||||
$this->post('/setup/update')
|
$this->post('/setup/update')->assertViewHas('tips');
|
||||||
->assertViewHas('tips');
|
|
||||||
$this->assertEquals('value', option('new_option'));
|
$this->assertEquals('value', option('new_option'));
|
||||||
$this->assertEquals('3.1.1', option('version'));
|
$this->assertEquals('3.1.1', option('version'));
|
||||||
unlink(database_path("update_scripts/update-$current_version-to-100.0.0.php"));
|
unlink(database_path("update_scripts/update-$current_version-to-100.0.0.php"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user