mc-blessing-skin/tests/HttpTest/MiddlewareTest/RedirectToSetupTest.php

32 lines
970 B
PHP
Raw Permalink Normal View History

2019-09-17 23:57:29 +08:00
<?php
namespace Tests;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Foundation\Testing\DatabaseTransactions;
2020-06-24 10:49:53 +08:00
use Illuminate\Support\Facades\Artisan;
2019-09-17 23:57:29 +08:00
class RedirectToSetupTest extends TestCase
{
use DatabaseTransactions;
public function testHandle()
{
$current = config('app.version');
config(['app.version' => '100.0.0']);
2020-06-24 10:49:53 +08:00
Artisan::shouldReceive('call')->with('update')->once();
$this->get('/');
2019-09-17 23:57:29 +08:00
config(['app.version' => $current]);
$this->mock(Filesystem::class, function ($mock) {
$mock->shouldReceive('exists')
->with(storage_path('install.lock'))
->andReturn(true, false, false);
});
2019-09-18 23:06:48 +08:00
$this->get('/')->assertViewIs('home');
2019-09-17 23:57:29 +08:00
$this->get('/setup')->assertViewIs('setup.wizard.welcome');
$this->get('/')->assertRedirect('/setup');
2019-11-13 14:27:22 +08:00
$this->assertEquals([], config('translation-loader.translation_loaders'));
2019-09-17 23:57:29 +08:00
}
}