From ef8e04a83ef3c0be2019425202ab61dad533721b Mon Sep 17 00:00:00 2001 From: Andrew Aitken-Fincham Date: Wed, 28 Jun 2017 17:24:47 +0100 Subject: [PATCH] Add $fixture_file to the fixtures docs Currently no mention of it. --- .../06_Testing/04_Fixtures.md | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/en/02_Developer_Guides/06_Testing/04_Fixtures.md b/docs/en/02_Developer_Guides/06_Testing/04_Fixtures.md index b3de024bc..cfc8f6004 100644 --- a/docs/en/02_Developer_Guides/06_Testing/04_Fixtures.md +++ b/docs/en/02_Developer_Guides/06_Testing/04_Fixtures.md @@ -9,6 +9,42 @@ SilverStripe starts with a fresh database containing no records. `Fixtures` prov to load into the database. The [api:SapphireTest] class takes care of populating a test database with data from fixtures - all we have to do is define them. +
+To include your fixture file in your tests, you should define it as your `$fixture_file`: + + +**mysite/tests/MyNewTest.php** + + :::php + + +Typically, you'd have a separate fixture file for each class you are testing - although overlap between tests is common. + Fixtures are defined in `YAML`. `YAML` is a markup language which is deliberately simple and easy to read, so it is ideal for fixture generation. Say we have the following two DataObjects: