Download the PHP package swisscom/aliceconnector without Composer
On this page you can find all versions of the php package swisscom/aliceconnector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download swisscom/aliceconnector
More information about swisscom/aliceconnector
Files in swisscom/aliceconnector
Package aliceconnector
Short Description Neos Flow package for expressive fixture generation based on alice
License MIT
Informations about the package aliceconnector
Neos Flow Alice connector
Neos Flow package for expressive fixture generation based on Alice.
The Swisscom.AliceConnector simply provides a Context that connects your functional test cases with Alice.
Getting started
Install the package through composer. You likely require it for dev only.
Configuration
Set the path to your fixture files in the Settings.yaml
:
Fixture creation
Create your file based Alice fixtures under the path defined in .
This basic example stored as Company.yaml
defines a single fixture object for the domain model Company
:
For a more real case example and documentation reference about the notation go to "[What does Alice?](#What does Alice?)".
Usage
Use the Context
in your test and load the fixtures. $testablePersistenceEnabled
should be enabled to work with persistence.
If you have persistence enabled, you could also query the fixture through your repository:
This example loads the fixture defined in
What does Alice?
Alice allows you to define expressive fixtures based on YAML, JSON or PHP files. Alice again is relying on Faker to create fake data for your fixtures.
The following sample shows you the real gain of Alice creating 10 random Person
entities with account and related entities:
We use fixture ranges {1..10}
to create the 10 objects each, fixture references (e.g. @personName
) as well as
faked data through faker formatters (e.g. firstName()
).
See the complete Alice reference for detailed information and more features.
What does Faker?
Faker simply provides random dummy data for your fixtures by providing formatters which can be used in Alice. See the available Faker formatters for complete reference.
The faker formatters are directly called in the fixture definition file.
Additionally, the Context
exposes the faker generator through getFaker()
, so that formatters can be used even directly in your code.
Custom Flow formatters
The package provides the following custom formatters for your Flow application.
Collection
A doctrine array collection:
Resource
A persistent resource:
Image asset with reference to a persistent resource:
Document asset with reference to a persistent resource:
Content string from a resourcee:
Security
Password hash for the given password:
Role object for the identifier:
Notes
- Context and providers are all stored inside the
Classes
folder to make them available not only for test cases. Possible use cases are fixture generation on demo environments or even master data imports on prod environments. - For reference data import see the Swisscom.ReferenceDataImport implementation which is based on this package.