WikiaSuperFactory (F::) and WikiaApp ($app) map MediaWiki coding practices to a set of helper objects and variables. The original intent was to make our code more unit testable by going through a layer of indirection before accessing any mediawiki global variable or function. Additionally, the unit test framework we were using did not allow us to mock classes that were constructed inside of a method instead of being passed in. After additional work, we switched to using the PHP extension runkit, which is a bit of a hack but allows us to test all the legacy code we have. After that, we removed the F::build() factory. WikiaApp still has some useful helper functions, and controllers still have the $this->wg attribute.
| Attributes | Values |
|---|
| rdfs:label
| - Nirvana/Quick Start Guide
|
| rdfs:comment
| - WikiaSuperFactory (F::) and WikiaApp ($app) map MediaWiki coding practices to a set of helper objects and variables. The original intent was to make our code more unit testable by going through a layer of indirection before accessing any mediawiki global variable or function. Additionally, the unit test framework we were using did not allow us to mock classes that were constructed inside of a method instead of being passed in. After additional work, we switched to using the PHP extension runkit, which is a bit of a hack but allows us to test all the legacy code we have. After that, we removed the F::build() factory. WikiaApp still has some useful helper functions, and controllers still have the $this->wg attribute.
|
| dcterms:subject
| |
| abstract
| - WikiaSuperFactory (F::) and WikiaApp ($app) map MediaWiki coding practices to a set of helper objects and variables. The original intent was to make our code more unit testable by going through a layer of indirection before accessing any mediawiki global variable or function. Additionally, the unit test framework we were using did not allow us to mock classes that were constructed inside of a method instead of being passed in. After additional work, we switched to using the PHP extension runkit, which is a bit of a hack but allows us to test all the legacy code we have. After that, we removed the F::build() factory. WikiaApp still has some useful helper functions, and controllers still have the $this->wg attribute. In a controller Object we add the $app and $wg helpers as class vars so the calling convention looks like this: $this->wg->memc->get('key'); $text = wfMessage('nirvana-is-awesome')->text(); In a template (View Object) we have added the $app $wg helpers to the template namespace itself, so the calling convention looks like this: text() ?>
|