Download the PHP package fkupper/module-dynamic-snapshots without Composer

On this page you can find all versions of the php package fkupper/module-dynamic-snapshots. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package module-dynamic-snapshots

Codeception Dynamic Snapshots Module

Build Status Coverage Status

This is a module that can be used together with Codeception to test Snapshots with dynamic data.

Installation

Using composer:

On your codeception.yml file, add:

Usage

Creating Snapshots

New snapshots cna be created using codeception client with the custom command in this package. Eg:

Fetching dynamic snapshot data

Similar to vanilla Codeception snapshots, the DynamicSnapshots classes will fetch data using the method fetchDynamicData. So, in your snapshots you will have to implement this method:

Substitutions

This is the main feature of this package. When dealing with variable data in snapshots, they can be replaced with placeholders and replaced back in runtime everytime the snapshot tests are executed.

For example, if you want to test a XML API response containing static data and variable data:

The property "appVersion" can change anytime and to avoid updating it every time, use setSubstitutions method to replace it with a string (or a value that can be casted to string) of your choice:

The first time the dynamic snapshot test is executed, a snapshot data file will be created like:

Note that placeholders are wrapped in [ ], and from now on, whenever the app version changes, the snapshot will not break or require an update.

Using the dynamic snapshot classes in tests

Please refer to Codepcetion's standard Snapshot documentation.

Custom placeholder wrappers

By default, placeholders are wrapped in brackets [ ], but it is possible to change what character or sequence of charaters it should use.

For example, if brackets are sensible part of your snapshot data, you can change it to something else using setWrappers:

Ignoring parts of the snapshot data

If your snapshot have variable data that cannot be tested or that you just want to igore, it is possible to provide a list of regular expression patterns that will be removed from the data when asserting.

For example, in the snapshot data below, the current timestamp in the favicon href property have to be ignored:

So you can ignore this line by calling setIgnoredLinesPatterns from your snapshot object:

Handling space sequences

Sometimes your snapshot data can have variable amounts of space characters in sequence that change out of your control.

To toggle your snapshot behavior to ignore these spaces or not, use shouldAllowSpaceSequences(true|false). Setting it to true will compact these space sequences to a single space character.

Note that the default is true, so these sequences will never be reduced to one space if you do not specify them to.

Handling trailing spaces

If you want to clear every line of your snapshot data of trailing spaces, use shouldAllowTrailingSpaces(false).

Note that the default is true, so trailing spaces in your snapshot data will never be removed.


All versions of module-dynamic-snapshots with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.|^8.1|^8.2
codeception/codeception Version ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fkupper/module-dynamic-snapshots contains the following files

Loading the files please wait ....