| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <?php
- use function Pest\Laravel\get;
- use function Pest\Laravel\post;
- it('should block access to installer index page when application is already installed', function () {
- // Act and Assert.
- get(route('installer.index'))
- ->assertRedirect(route('shop.home.index'));
- });
- it('should block access to env file setup endpoint when application is already installed', function () {
- // Act and Assert.
- $response = post(route('installer.env_file_setup'), [
- 'db_hostname' => 'localhost',
- 'db_port' => '3306',
- 'db_name' => 'test_db',
- 'db_username' => 'root',
- 'db_password' => '',
- ]);
- $response->assertRedirect(route('shop.home.index'));
- });
- it('should block access to run migration endpoint when application is already installed', function () {
- // Act and Assert.
- post(route('installer.run_migration'))
- ->assertRedirect(route('shop.home.index'));
- });
- it('should block access to run seeder endpoint when application is already installed', function () {
- // Act and Assert.
- post(route('installer.run_seeder'), [
- 'selectedParameters' => [
- 'allowed_locales' => ['en'],
- 'allowed_currencies' => ['USD'],
- ],
- 'allParameters' => [
- 'app_locale' => 'en',
- 'app_currency' => 'USD',
- ],
- ])
- ->assertRedirect(route('shop.home.index'));
- });
- it('should block access to download sample endpoint when application is already installed', function () {
- // Act and Assert.
- get(route('installer.download_sample'))
- ->assertRedirect(route('shop.home.index'));
- });
- it('should block access to admin config setup endpoint when application is already installed', function () {
- // Act and Assert.
- post(route('installer.admin_config_setup'), [
- 'admin' => 'Admin User',
- 'email' => 'admin@example.com',
- 'password' => 'admin123',
- ])
- ->assertRedirect(route('shop.home.index'));
- });
- it('should block access to sample products setup endpoint when application is already installed', function () {
- // Act and Assert.
- post(route('installer.sample_products_setup'), [
- 'selectedLocales' => ['en'],
- 'selectedCurrencies' => ['USD'],
- ])
- ->assertRedirect(route('shop.home.index'));
- });
- it('should return 403 for ajax request to env file setup endpoint when already installed', function () {
- // Act and Assert.
- post(route('installer.env_file_setup'), [
- 'db_hostname' => 'localhost',
- 'db_port' => '3306',
- 'db_name' => 'test_db',
- 'db_username' => 'root',
- 'db_password' => '',
- ], [
- 'X-Requested-With' => 'XMLHttpRequest',
- ])
- ->assertStatus(403)
- ->assertJson([
- 'message' => trans('installer::app.installer.middleware.already-installed'),
- ]);
- });
- it('should return 403 for ajax request to run migration endpoint when already installed', function () {
- // Act and Assert.
- post(route('installer.run_migration'), [], [
- 'X-Requested-With' => 'XMLHttpRequest',
- ])
- ->assertStatus(403)
- ->assertJson([
- 'message' => trans('installer::app.installer.middleware.already-installed'),
- ]);
- });
- it('should return 403 for ajax request to run seeder endpoint when already installed', function () {
- // Act and Assert.
- post(route('installer.run_seeder'), [
- 'selectedParameters' => [
- 'allowed_locales' => ['en'],
- 'allowed_currencies' => ['USD'],
- ],
- 'allParameters' => [
- 'app_locale' => 'en',
- 'app_currency' => 'USD',
- ],
- ], [
- 'X-Requested-With' => 'XMLHttpRequest',
- ])
- ->assertStatus(403)
- ->assertJson([
- 'message' => trans('installer::app.installer.middleware.already-installed'),
- ]);
- });
- it('should return 403 for ajax request to download sample endpoint when already installed', function () {
- // Act and Assert.
- get(route('installer.download_sample'), [
- 'X-Requested-With' => 'XMLHttpRequest',
- ])
- ->assertStatus(403)
- ->assertJson([
- 'message' => trans('installer::app.installer.middleware.already-installed'),
- ]);
- });
- it('should return 403 for ajax request to admin config setup endpoint when already installed', function () {
- // Act and Assert.
- post(route('installer.admin_config_setup'), [
- 'admin' => 'Admin User',
- 'email' => 'admin@example.com',
- 'password' => 'admin123',
- ], [
- 'X-Requested-With' => 'XMLHttpRequest',
- ])
- ->assertStatus(403)
- ->assertJson([
- 'message' => trans('installer::app.installer.middleware.already-installed'),
- ]);
- });
- it('should return 403 for ajax request to sample products setup endpoint when already installed', function () {
- // Act and Assert.
- post(route('installer.sample_products_setup'), [
- 'selectedLocales' => ['en'],
- 'selectedCurrencies' => ['USD'],
- ], [
- 'X-Requested-With' => 'XMLHttpRequest',
- ])
- ->assertStatus(403)
- ->assertJson([
- 'message' => trans('installer::app.installer.middleware.already-installed'),
- ]);
- });
|