Download the PHP package suffle/snapshot without Composer

On this page you can find all versions of the php package suffle/snapshot. 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 snapshot

Suffle.Snapshot

A Neos CMS package to perform snapshot tests of fusion components

Regression testing for fusion components

Inspired by Jest and its snapshot testing for React Components, this package helps reducing unwanted side-effects when changing existing Fusion Components. Especially in big projects it is often hard to keep an eye on every usage of a component and which other component might be influenced. Snapshot testing reduces regression bugs by rendering Fusion Components and saving their outcome. If the code of a Fusion Component is changed, the snapshots are no longer in sync with the new outcome, which gives the developer two possibilities:

  1. Adjust the code to keep old behaviour where needed
  2. Update the old snapshots

Nevertheless, the developer needs to address the changed code somehow. The tests can also be run automatically as part of a CI-Build.

Installation

Add the dependency to your project like this:

composer require --dev suffle/snapshot

Example configuration

The Snapshot Tests are configured as regular Flow settings.

`

snapshotSavePath

The snapshotSavePath defines the directory, where the snapshots are saved. If you use any Version Control Software like Git, make sure not to ignore this folder.

annotationKey

The annotationKey can be set, if you want to use another name to annotate test cases. Since the syntax of the cases is the same used for the Monocle Styleguide, you can use the styleguide annotation for the testing as well.

Annotating Test Cases

As long as the annotation ist present, the component is tested in a pure version, which uses the basic props of the Fusion Component.

Keep in mind

The snapshot tests are not using any database content or context variables other than the ones set directly in the tested component. You can't test any actual nodes or refer to context variables like node, site or documentNode.

Taking Snapshots

You can take snapshots of components via the cli:

Take snapshots of all components

If you want to take snapshots of your annotated Fusion Components, you can use the cli to take snapshots of all components:

This takes and overwrites snapshots of all components in all active site packages.

If there is no snapshot present for a component, the first snapshot will also be taken automatically during a test run.

Take Snapshot of specific component

If you want to restrict the snapshots taken to a specific component, you can use the take-Command:

Testing components

Like with taking new snapshots, it is also possible to test all or only specific components. If you test new components or propSets whithout any snapshots available, the snapshots will be written on the first run.

Test all components

As a standard test mechanism this tests all components from all site packages prepared for testing:

Test single component

Sometimes it is useful to test only single components, e.g. while developing:

Using interactive mode

By using the --interactive flag with a test command, the interactive mode is turned on. When a test of a component and its propSet fails, the diff of the rendered Fusion and the snapshots are shown and a prompt of what to do next, possibilities are:

Input Effect
y Update the current snapshot
n Do not update the snapshot, causing the test to fail
q Immediately stop the testing
a Update the current and all following snapshots that fail
d Do not update this or any of the following snapshots that fail

Update all failing snapshots

It is also possible to automatically update all snapshots of failing tests. Just add the --updateall flag to a test command.

List all items to test

If you need a list of all components that are ready for testing, you can use:

Restricting command to a specific site package

All CLI Commands can be restricted to a specific site package. Just add --packageName "sitePackageName" as an option.


All versions of snapshot with dependencies

PHP Build Version
Package Version
Requires neos/neos Version ~4.2 || ~5.0 || ~7.0 || dev-master
sebastian/diff Version 3.*
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 suffle/snapshot contains the following files

Loading the files please wait ....