9 * This source file is subject to the new BSD license that is bundled
10 * with this package in the file LICENSE.
11 * It is also available through the world-wide-web at this URL:
12 * http://phergie.org/license
16 * @author Phergie Development Team <team@phergie.org>
17 * @copyright 2008-2010 Phergie Development Team (http://phergie.org)
18 * @license http://phergie.org/license New BSD License
19 * @link http://pear.phergie.org/package/Phergie
22 require_once(dirname(__FILE__) . '/TestCase.php');
25 * Unit test suite for Pherge_Plugin_TerryChay.
28 * @package Phergie_Tests
29 * @author Phergie Development Team <team@phergie.org>
30 * @license http://phergie.org/license New BSD License
31 * @link http://pear.phergie.org/package/Phergie
33 class Phergie_Plugin_TerryChayTest extends Phergie_Plugin_TestCase
36 * Sets up the fixture, for example, opens a network connection.
37 * This method is called before a test is executed.
39 protected function setUp()
41 $this->setPlugin(new Phergie_Plugin_TerryChay());
42 $config = new Phergie_Config();
43 $handler = new Phergie_Plugin_Handler($config, $this->handler);
44 $this->plugin->setPluginHandler($handler);
45 $handler->addPlugin($this->plugin);
46 $handler->addPlugin(new Phergie_Plugin_Http($config));
47 $this->plugin->setConfig($config);
48 $this->connection->setNick('phergie');
49 $this->plugin->onLoad();
53 * @event Phergie_Event_Request::privmsg
57 public function testWithTyChay()
59 $this->plugin->onPrivMsg();
60 $this->assertHasEvent(Phergie_Event_Command::TYPE_PRIVMSG);
64 * @event Phergie_Event_Request::privmsg
68 public function testWithTerryChay()
70 $this->plugin->onPrivMsg();
71 $this->assertDoesNotHaveEvent(Phergie_Event_Command::TYPE_PRIVMSG,
72 'string "terrychay" should not invoke a response');
76 * @event Phergie_Event_Request::privmsg
78 * @eventArg terry chay
80 public function testWithTerry_Chay()
82 $this->plugin->onPrivMsg();
83 $this->assertHasEvent(Phergie_Event_Command::TYPE_PRIVMSG,
84 'string "terry chay" should invoke a response');
88 * @event Phergie_Event_Request::privmsg
90 * @eventArg Elazar is not Mr. Chay
92 public function testWithNoTyChay()
94 $this->plugin->onPrivMsg();
95 $this->assertDoesNotHaveEvent(Phergie_Event_Command::TYPE_PRIVMSG,
96 'Failed asserting that elazar is not ' .