/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Foundation/Testing/RefreshDatabaseTest.php
97 строк
3 KB
Jason McCreary
[13.x] Mockery cleanup (#61117)
10 авг 2026, 20:23
Не верифицирован
10 авг 2026, 20:23
2ee40ee
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Foundation\Testing; use Illuminate\Contracts\Console\Kernel as ConsoleKernelContract; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Foundation\Testing\Concerns\InteractsWithConsole; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabaseState; use Mockery; use Orchestra\Testbench\Concerns\ApplicationTestingHooks; use Orchestra\Testbench\Foundation\Application as Testbench; use PHPUnit\Framework\TestCase; use function Orchestra\Testbench\package_path; class RefreshDatabaseTest extends TestCase { use ApplicationTestingHooks; use InteractsWithConsole; use RefreshDatabase; public $dropViews = false; public $dropTypes = false; protected function setUp(): void { RefreshDatabaseState::$migrated = false; $this->setUpTheApplicationTestingHooks(); $this->withoutMockingConsoleOutput(); } protected function tearDown(): void { $this->tearDownTheApplicationTestingHooks(); RefreshDatabaseState::$migrated = false; } protected function refreshApplication() { $this->app = Testbench::create( basePath: package_path('vendor/orchestra/testbench-core/laravel'), ); } public function testRefreshTestDatabaseDefault() { $kernel = Mockery::spy(ConsoleKernel::class); $this->app->instance(ConsoleKernelContract::class, $kernel); $kernel->expects('call') ->with('migrate:fresh', [ '--drop-views' => false, '--drop-types' => false, '--seed' => false, ]); $this->refreshTestDatabase(); } public function testRefreshTestDatabaseWithDropViewsOption() { $this->dropViews = true; $kernel = Mockery::spy(ConsoleKernel::class); $this->app->instance(ConsoleKernelContract::class, $kernel); $kernel->expects('call') ->with('migrate:fresh', [ '--drop-views' => true, '--drop-types' => false, '--seed' => false, ]); $this->refreshTestDatabase(); } public function testRefreshTestDatabaseWithDropTypesOption() { $this->dropTypes = true; $kernel = Mockery::spy(ConsoleKernel::class); $this->app->instance(ConsoleKernelContract::class, $kernel); $kernel->expects('call') ->with('migrate:fresh', [ '--drop-views' => false, '--drop-types' => true, '--seed' => false, ]); $this->refreshTestDatabase(); } }