PHPackages                             unionofrad/li3\_fixtures - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. unionofrad/li3\_fixtures

ActiveLithium-library[Testing &amp; Quality](/categories/testing)

unionofrad/li3\_fixtures
========================

The fixtures library for the li3 PHP framework

v1.1.1(9y ago)672.0k↓23.5%61BSD-3-ClausePHPPHP &gt;=5.5.14

Since Apr 8Pushed 6y ago6 watchersCompare

[ Source](https://github.com/UnionOfRAD/li3_fixtures)[ Packagist](https://packagist.org/packages/unionofrad/li3_fixtures)[ Docs](http://li3.me)[ RSS](/packages/unionofrad-li3-fixtures/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (12)Used By (1)

Fixtures Management for the li₃ framework.
==========================================

[](#fixtures-management-for-the-li-framework)

This plugin provide fixtures managment. Should work with any kind of `Source`adapters. The fixture class support the following datasource's hints:

- If `Source::enabled('schema')` returns `true`, the `Fixture` manage schema (i.e create/drop) via `Source::createSchema()` &amp; `Source::dropSchema()`.
- If `Source::enabled('sources')` returns `true`, the `Fixture` allow soft drop (i.e safe options).

Installation
------------

[](#installation)

The preferred installation method is via composer. You can add the library as a dependency via:

```
composer require unionofrad/li3_fixtures

```

li₃ plugins must be registered within your application bootstrap phase as they use a different (faster) autoloader.

```
Libraries::add('li3_fixtures')
```

The official manual has more information on [how to register the plugin](http://li3.me/docs/manual/installation/plugins.md)with the app or use alternative installation methods (i.e. via GIT).

API
---

[](#api)

### The Fixture class

[](#the-fixture-class)

#### Methods:

[](#methods)

- Fixture::create($safe); //Create the source only
- Fixture::save($safe); //Create the source + save the fixture's records in.
- Fixture::drop($safe); //Drop the source.
- Fixture::populate($records); //Insert a record in the database
- Fixture::alter($mode, $fieldname, $value); //Altering the schema before `::create()/::save()`.

Simple example of unit test:

```
