vendredi 20 février 2015

ZF2 phpUnit test view helper

Unfortunatelly i'm absolute zero in ZF2 and unit testing. I wrote simple view helper(wrapper function of Zend Translate) and now i have to write a test for this. I'm trying to add one test in existing test class, so everything is configured ...maybe. I simply need to get to work this code:



public function testTranslation()
{
$result = $this->t('about');
$expected = "About";
$this->assertEquals($exp, $res);
}


I also tried to get functionality like i do it in controllers, but no luck:



$t = $this->getServiceLocator()->get('ViewHelperManager')->get('t');
$result = $t('about');


Any help ?


Aucun commentaire:

Enregistrer un commentaire