]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Irc/extlib/phergie/Tests/Phergie/Plugin/PongTest.php
Added Phergie PHP IRC library
[quix0rs-gnu-social.git] / plugins / Irc / extlib / phergie / Tests / Phergie / Plugin / PongTest.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_Pong.
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_PongTest 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_Pong);
42     }
43
44     /**
45      * Test that when a ping is received, a Phergie_Event_Command::TYPE_PONG
46      * is set to the handler
47      *
48      * @event Phergie_Event_Command::TYPE_PING
49      */
50     public function testOnPing()
51     {
52         $this->plugin->onPing();
53         $this->assertHasEvent(Phergie_Event_Command::TYPE_PONG);
54     }
55
56     /**
57      * Test that when a ping is received, a Phergie_Event_Command::TYPE_PONG
58      * is set to the handler
59      *
60      * @event Phergie_Event_Command::TYPE_PING
61      */
62     public function testOnPingResponseArguement()
63     {
64         $this->plugin->onPing();
65         $this->assertHasEvent(Phergie_Event_Command::TYPE_PONG);
66         $events = $this->getResponseEvents(Phergie_Event_Command::TYPE_PONG);
67         $this->assertTrue(count($events) === 1, 'Assert that only one pong is emitted');
68         $this->assertEventEmitter(current($events),
69                                   $this->plugin,
70                                   'Assert that the tested plugin emitted the event');
71
72     }
73
74 }