Skip to content
Vlad edited this page Oct 27, 2017 · 5 revisions

Every single fixture file represents only one SQL table and it's data. All the further SQL instructions(like INSERT, DELETE and others) will be generated using this table name.

There is a convention that the fixture file name converts to SQL table name almost "as is":

  • users.yaml fixture generates instructions for users table
  • ticket_comments.yaml fixture generates instructions for ticket_comments table
  • Man_In_Black.yaml fixture generates instructions for Man_In_Black table

But the only exception does exist: dots in fixture file name are prohibited, except the dot in .yaml(or .yml) file extension. If you'd like to define a table with dots, like, public.comments or search.articles, please, use sub folders with unlimited depth:

  users.yaml        # users
+ public/
    comments.yaml   # public.comments
    tickets.yaml    # public.tickets
+ search/
    articles.yaml   # search.articles
    references.yaml # search.references
  + old/
      usage.yaml    # search.old.usage
      failures.yaml # search.old.failures

Sub folders with fixtures either can not have dots to avoid collisions like below:

+ old/
  + searches/
    log.yaml        # old.searches.log
+ old.searches/
  log.yaml          # also old.searches.log?

Note, that YAML files have two valid extensions: .yaml and .yml. Both extensions are equally supported by JFixtures. However, there is an edge case: the same fixture could not be located twice with different extensions:

  users.yaml        # users
+ public/
    comments.yaml   # public.comments
    comments.yml    # public.comments

JFixtures will throw an exception because public.comments table was defined twice in this example(by public/comments.yaml and public/comments.yml)

Clone this wiki locally