diff --git a/tests/Database/DatabaseSqliteSchemaStateTest.php b/tests/Database/DatabaseSqliteSchemaStateTest.php index 1a3c47ff79e5..928712674b5f 100644 --- a/tests/Database/DatabaseSqliteSchemaStateTest.php +++ b/tests/Database/DatabaseSqliteSchemaStateTest.php @@ -26,13 +26,14 @@ public function testLoadSchemaToDatabase(): void $connection->shouldReceive('getDatabaseName')->andReturn($config['database']); $process = m::spy(Process::class); - $processFactory = function () use ($process) { - return $process; - }; + $processFactory = m::mock(new ProcessFactory($process)); $schemaState = new SqliteSchemaState($connection, null, $processFactory); $schemaState->load('database/schema/sqlite-schema.dump'); + $processFactory->shouldHaveReceived('__invoke') + ->with('sqlite3 "${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"'); + $process->shouldHaveReceived('mustRun')->with(null, [ 'LARAVEL_LOAD_DATABASE' => 'database/database.sqlite', 'LARAVEL_LOAD_PATH' => 'database/schema/sqlite-schema.dump', @@ -56,3 +57,18 @@ public function testLoadSchemaToInMemory(): void $pdo->shouldHaveReceived('exec')->with('CREATE TABLE IF NOT EXISTS "migrations" ("id" integer not null primary key autoincrement, "migration" varchar not null, "batch" integer not null);'); } } + +class ProcessFactory +{ + private $process; + + public function __construct($process) + { + $this->process = $process; + } + + public function __invoke() + { + return $this->process; + } +}