fixture

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package fixture builds fake WordPress/WooCommerce, Magento 2 and Laravel databases for tests, and a generic one no preset knows. All data is invented: names from short lists, streets and cities mixed at random, phone numbers in the 555-01xx range reserved for fiction, IP addresses from the documentation ranges. Secret-looking strings are assembled at run time so that none sits in the repository.

Index

Constants

This section is empty.

Variables

View Source
var Platforms = []string{"wordpress", "magento2", "laravel", "generic"}

Platforms lists the fixtures Build can make.

Functions

func Build

func Build(ctx context.Context, admin *sql.DB, platform, database string, opts Options) error

Build drops and recreates the database and fills it with fake data for the platform. admin needs multiStatements=true and the right to create databases.

Types

type Options

type Options struct {
	// Canary is placed inside several stored values. Reports must never
	// contain it.
	Canary string
	// Planted, when set, receives the secrets the fixture plants, for leak
	// tests. It stays in memory.
	Planted *Planted
}

Options for Build.

type Planted added in v0.5.0

type Planted struct {
	Values []string
	Random []string
}

Planted lists the secrets a fixture plants, for leak tests: the values, and the generated parts of each, of which no output may hold any eight characters in a row. It is kept in memory only, never written to a file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL