Skip to content

Commit

Permalink
closure
Browse files Browse the repository at this point in the history
  • Loading branch information
recca0120 committed Dec 21, 2022
1 parent 90d17e9 commit f242b45
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions tests/Database/DatabaseSqliteSchemaStateTest.php
Expand Up @@ -26,7 +26,9 @@ public function testLoadSchemaToDatabase(): void
$connection->shouldReceive('getDatabaseName')->andReturn($config['database']);

$process = m::spy(Process::class);
$processFactory = m::mock(new ProcessFactory($process));
$processFactory = m::spy(function () use ($process) {
return $process;
});

$schemaState = new SqliteSchemaState($connection, null, $processFactory);
$schemaState->load('database/schema/sqlite-schema.dump');
Expand Down Expand Up @@ -57,18 +59,3 @@ 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;
}
}

0 comments on commit f242b45

Please sign in to comment.