]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Irc/extlib/phergie/Tests/Phergie/Plugin/TerryChayTest.php
Added Phergie PHP IRC library
[quix0rs-gnu-social.git] / plugins / Irc / extlib / phergie / Tests / Phergie / Plugin / TerryChayTest.php
1 <?php
2 /**
3  * Phergie
4  *
5  * PHP version 5
6  *
7  * LICENSE
8  *
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
13  *
14  * @category  Phergie
15  * @package   Phergie
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
20  */
21
22 require_once(dirname(__FILE__) . '/TestCase.php');
23
24 /**
25  * Unit test suite for Pherge_Plugin_TerryChay.
26  *
27  * @category Phergie
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
32  */
33 class Phergie_Plugin_TerryChayTest extends Phergie_Plugin_TestCase
34 {
35     /**
36      * Sets up the fixture, for example, opens a network connection.
37      * This method is called before a test is executed.
38      */
39     protected function setUp()
40     {
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();
50     }
51
52     /**
53      * @event Phergie_Event_Request::privmsg
54      * @eventArg #zftalk
55      * @eventArg tychay
56      */
57     public function testWithTyChay()
58     {
59         $this->plugin->onPrivMsg();
60         $this->assertHasEvent(Phergie_Event_Command::TYPE_PRIVMSG);
61     }
62
63     /**
64      * @event Phergie_Event_Request::privmsg
65      * @eventArg #zftalk
66      * @eventArg terrychay
67      */
68     public function testWithTerryChay()
69     {
70         $this->plugin->onPrivMsg();
71         $this->assertDoesNotHaveEvent(Phergie_Event_Command::TYPE_PRIVMSG,
72                               'string "terrychay" should not invoke a response');
73     }
74     
75     /**
76      * @event Phergie_Event_Request::privmsg
77      * @eventArg #zftalk
78      * @eventArg terry chay
79      */
80     public function testWithTerry_Chay()
81     {
82         $this->plugin->onPrivMsg();
83         $this->assertHasEvent(Phergie_Event_Command::TYPE_PRIVMSG,
84                               'string "terry chay" should invoke a response');
85     }
86
87     /**
88      * @event Phergie_Event_Request::privmsg
89      * @eventArg #zftalk
90      * @eventArg Elazar is not Mr. Chay
91      */
92     public function testWithNoTyChay()
93     {
94         $this->plugin->onPrivMsg();
95         $this->assertDoesNotHaveEvent(Phergie_Event_Command::TYPE_PRIVMSG,
96                                       'Failed asserting that elazar is not ' .
97                                       'tychay');
98     }
99 }