Download the PHP package lucatume/wp-snaphot-assertions without Composer

On this page you can find all versions of the php package lucatume/wp-snaphot-assertions. 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 wp-snaphot-assertions

WordPress Snapshot Assertions

Snapshot testing of WordPress code for PHPUnit, based on the PHPUnit Snapshot Assertions package by Spatie.

Build Status

Installation

Usage

Snapshot testing comes very handy when testing the HTML output of some WordPress generated and managed code.
In such instances WordPress will often generate time-dependent values, like nonces, and full URLs, like image sources.
Those environment and time related differences might break a snapshot for the wrong reasons; e.g. the snapshot was generated on one machine (say locally) and ran on another machine where WordPress might be served at another URL and the test will surely run at a different time (say CI).
For that purpose the WPHtmlOutputDriver driver was born:

By default the driver will lok for time-dependent fields with an id, name or class from a default list (e.g. _wpnonce); you might want to add or modify that list using the WPHtmlOutputDriver::setTimeDependentKeys method.

On the same note, the driver will look for some attributes when looking to replace the snapshot URL with the current URL; you can modify those using the WPHtmlOutputDriver::setUrlAttributes method.

Very often WordPress HTML will contain attributes and strings that will inline post IDs, titles and other fields; in general the comparison of the snapshots should not fail because the random post ID used when the snapshot was generated was 23 but it's, in another test run, 89.

To avoid that use the WPHtmlOutputDriver::setTolerableDifferences method to define what values defined in the current test run should not trigger a failure (see example above); furthermore run-dependent variables could be used to construct id, class, data and other attributes: if you know that the rendered HTML will contain something like this (where 23 is the post ID):

You might want to say to the driver that the current post ID is a tolerable difference even when prefixed with prefix- or postfixed with -postfix:

When HTML attributes contain truly unique or time-dependent values, those attributes can be excluded completely using the WPHtmlOutputDriver::setTimeDependentAttributes method.


All versions of wp-snaphot-assertions with dependencies

PHP Build Version
Package Version
Requires ext-dom Version *
electrolinux/phpquery Version ^0.9.6
php Version ^7.3|^7.4|^8.0
spatie/phpunit-snapshot-assertions Version ^4.2
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 lucatume/wp-snaphot-assertions contains the following files

Loading the files please wait ....