2

I've gotten as far as getting a tag to run with it's default parameters, but I have no clue on how to fake the passing of parameters and tagdata.

I've checked the documentation for testee and munged a bit through it's own tests. I realize it is an unsupported addon as the author has moved away from ExpressionEngine, but that is why I am asking here.

Here's a working test so far:

public function test__returns_zero_with_default_attributes() {

    $result = $this->_subject->modulo();
    $this->assertEqual($result, 0);

}
1

Turns out it works this way:

$this->_subject->EE->TMPL->returns('fetch_param', 11, array('numerator', '1'));

This says when the mock EE object receives a call to fetch_param with the arguments 'numerator' and '1' ($this->EE->fetch_param('numerator', '1') in the plugin code) return the value 11.

Similar can be done for the tagdata property:

$this->_subject->EE->tagdata = 'This is text simulating the contents of a tag pair';

Voila! Now you can test module and plugin tags.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.