Skip to content

Commit

Permalink
added faker package to development libraries for mocking up content
Browse files Browse the repository at this point in the history
  • Loading branch information
James Wigger committed Jul 18, 2017
1 parent 2025e3c commit 7f6f55e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@
"files": [
"helpers.php"
]
},
"require-dev": {
"fzaninotto/faker": "^1.6"
}
}
15 changes: 15 additions & 0 deletions helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,18 @@ function base_layout_has($key)
return false;
}
}

/**
* Returns a new faker instance for mocking content
*
* @return Faker\Generator
*/
if(!function_exists('base_faker_factory')) {
function base_faker_factory() {
if(!class_exists('Faker\Factory')) {
throw new Exception('Faker library is not installed - are you running in production?');
}

return Faker\Factory::create();
}
}

0 comments on commit 7f6f55e

Please sign in to comment.