This repository was archived by the owner on Feb 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
7.x 2.x Function: at_fn
Andy Truong edited this page Feb 26, 2014
·
3 revisions
Drupal code is function base structure. So it's very hard to override some Drupal's default functions, which leads to untestable code.
For example, if our class use l(), the function which perform SQL query to database, we can not write unit test for our class. We need way to override it, poorly, we can not do it nicely, we have to wrap the function call with at_fn() — use at_fn('l', $text, $path) instead of l($text, $path). Then, to override default l(), just call at_fn_fake('l', function($text, $path){ return '<a href="/'. $path .'">'. $text .'</a>'; })
___ ___________ _ _
/ _ \_ _| ___ \ | | | |
/ /_\ \| | | |_/ / __ _ ___ ___ _ __ ___ ___ __| |_ _| | ___
| _ || | | ___ \/ _` / __|/ _ \ | '_ ` _ \ / _ \ / _` | | | | |/ _ \
| | | || | | |_/ / (_| \__ \ __/_| | | | | | (_) | (_| | |_| | | __/
\_| |_/\_/ \____/ \__,_|___/\___(_)_| |_| |_|\___/ \__,_|\__,_|_|\___|
- Caching
- Twig template
- twig Service
- twig_string Service
- Recipes
- Extends
- Easy Block
- Easy Routing
- Easy Breadcrumb
- Entity Template
- Drush Commands:
- Functions:
- Misc
- Status
- Tools for Development enviroment
- /devel/php improved
- /at/sql
- /at/twig
- Kint integration