Skip to content

CorpusFactory ​

Rasuvaeff\PropertyTesting\Runner\CorpusFactory

Class — Package: property-testing-core — Source — Version: v1.0.0-1-g88fdee2

The corpus a PROPERTY_DB value names.

A plain path is a Runner\FilesystemCorpus; redis:// and rediss:// are a Runner\RedisCorpus over ext-redis when it is loaded, predis otherwise; any other scheme is refused. The adapter reads the environment (the engine never does — golden rule) and hands the value here, so the two adapters mean the same thing by the same DSN.

php
$corpus = CorpusFactory::fromDsn('/tmp/corpus');
$corpus = CorpusFactory::fromDsn('redis://redis:6379/2?prefix=suite-a:');
$corpus = CorpusFactory::fromDsn('redis://redis:6379', $password);

Methods ​

fromDsn() ​

php
static fromDsn(string $dsn, ?string $password = NULL): Runner\Corpus

The corpus for a PROPERTY_DB value — the same instance for the same value and password within a process.

  • $dsn — A directory path, or a redis:// / rediss:// DSN.
  • $password — The AUTH password for a Redis DSN, read from the environment by the adapter (PROPERTY_DB_PASSWORD). Ignored for a directory; empty means none.

Throws:

  • InvalidArgumentException — For a scheme that is not redis/rediss, an unusable Redis DSN, or a Redis DSN without any Redis client available.