Created
December 5, 2012 21:07
-
-
Save tarmstrong/4219498 to your computer and use it in GitHub Desktop.
Phergie test additional method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Phergie_Plugin_PhpTest extends Phergie_Plugin_TestCase | |
{ | |
/** | |
* Tests for appropriate plugin requirements. | |
* | |
* @return void | |
*/ | |
public function testPluginRequirements() | |
{ | |
$this->assertRequiresPlugin('Command'); | |
$this->setConfig('plugin.php.source', 'test'); | |
$this->plugin->onLoad(); | |
} | |
/** | |
* Test that the bot will respond with function documentation. | |
*/ | |
public function testOnCommmandPhp() | |
{ | |
$this->setConfig('plugin.php.source', 'test'); | |
$this->plugin->onLoad(); | |
$this->initializePhpEvent('array_map'); | |
$this->assertEmitsEvent('privmsg', array($this->source, $this->nick. ': hello')); | |
$this->plugin->onCommandPhp('array_map'); | |
$this->initializePhpEvent('xxxx'); | |
$this->assertEmitsEvent('notice', array($this->source, 'Search for function xxxx returned no results.')); | |
$this->plugin->onCommandPhp('xxxx'); | |
} | |
private function initializePhpEvent($function) { | |
$args = array( | |
'receiver' => $this->source, | |
'text' => 'php ' . $function | |
); | |
$event = $this->getMockEvent('privmsg', $args); | |
$this->plugin->setEvent($event); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment