Hi,
I jumped into PW a few months ago and now is the moment when i want/need to have unit tests. No really on the CMS part but more likely on the modules or pages classes i create.
However i was not able to find a "how to" to do so. How do i get fake data (factory for users), bootstrap everything to be able to call the method inside a module or unit test a hook applied a core module?
I dont get a clear idea of how to achieve that under PW.
As an example, let say i created a survey Module. and let say i have a fct like this within my module
<?php namespace ProcessWire;
class Survey extends WireData implements Module
public function__construct() {
[blablabla]
}
public function getSurveyUrl($lang)
{
$surveyPage = $this->pages->get('template=survey);
return $surveyPage->localUrl($lang);
}
How would i create a unit test for that?
Thanks in advance
Note: i ve already read the FrancisChung post but it looks like a work around (for front end) rather that the "comme il faut" way