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_Pong.
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_PongTest 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_Pong);
45 * Test that when a ping is received, a Phergie_Event_Command::TYPE_PONG
46 * is set to the handler
48 * @event Phergie_Event_Command::TYPE_PING
50 public function testOnPing()
52 $this->plugin->onPing();
53 $this->assertHasEvent(Phergie_Event_Command::TYPE_PONG);
57 * Test that when a ping is received, a Phergie_Event_Command::TYPE_PONG
58 * is set to the handler
60 * @event Phergie_Event_Command::TYPE_PING
62 public function testOnPingResponseArguement()
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),
70 'Assert that the tested plugin emitted the event');