Download the PHP package derptest/phpmachinist without Composer

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

Build Status SensioLabsInsight

PHPMachinist: Testing Object Factory

What???!??!

A Slightly less annoying way of creating database fixtures for PHP testing. It borrows heavily from several projects:

They're totally awesome. Just either in the wrong language, or didn't quite do what I wanted.

Hip Hop VM (HHVM) Support

Hip Hop VM is supported and tested. If you want to use the Doctrine store, it will require Doctrine ORM 2.4.x or newer.

Data Store Support

The following data stores are currently supported:

Install

Add the package derptest/phpmachinist to your composer.json For more information about Composer, please visit http://getcomposer.org

Configure

Configuration of PHP Machinist happens in two steps:

  1. Register data stores

    Registering data stores is done via either the static Machinist::store() method or the addStore() method on a Machinist instance. Both methods take the same parameters, a StoreInterface instance and an optional name for that store. If no name is given, it will default to default. Below is an example of both:

    Note: when using the pdo error mode will be set. It will default to exception such that a test that triggers an error will throw an exception and fail. This default behavior can be overridden by passing an error mode as the second parameter of the factory method.

  2. Define Blueprints

    Blueprints are what define the entities in your data store by allowing you to configure the following:

    • The StoreInterface to use when saving or retrieving data for the blueprint
    • The table/collection in which the data will be stored
    • The default values for columns/properties in the table/collection. Default values allow you to only deal with the data that is truly important to your test logic and not waste time and clutter your test code with setting values that are meaningless but required by your data store
    • The relationships between the blueprint and other previously defined blueprints

    Multiple blueprints may be defined for the same table/collection. This allows you to quickly set up use multiple sets of default values for your data. The below example shows the creation of two blueprints for a user table with different roles. Defining multiple blueprints makes your tests more readable not to mention faster to write.

Relationships in depth

Relationships are quite possibly the strongest feature of PHP Machinist. They allow you to quickly associate related data without having to worry about primary keys, foreign keys, and all that other nonsense in your actual tests. They will even do some "find or create" magic for you. Here is how you use the Blueprints from the example above to create two users and one company really quickly.

That's the fill sum of the code needed to create two users and one company. PHP Machinist did some magic on the first blueprint make call. It looked for a company with the name of Pedro for Class President. It didn't find one, so it created a company and used that for the relationship. For the second make() call, it found the company created in the first call and used that company for the relationship.

Relationships will also populate data from data finds as well. Here is an example using the same blueprints and the data created from the previous example.

This will result in Pedro for Class President being shown on the screen.

License

See LICENSE file in the project


All versions of phpmachinist with dependencies

PHP Build Version
Package Version
Requires php Version >5.3.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 derptest/phpmachinist contains the following files

Loading the files please wait ....