X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FIrc%2Fextlib%2Fphergie%2FTests%2FPhergie%2FPlugin%2FPongTest.php;h=e8351fef2449c044a40b6215939c1bf6ca8f34ad;hb=e211e6228d7f7742967686005c693697e327e366;hp=a8bc8fd05f4d71b4eaf9c22351c62975bd674f23;hpb=bee50840728ca8af99e988bcce71876849ba61d3;p=quix0rs-gnu-social.git diff --git a/plugins/Irc/extlib/phergie/Tests/Phergie/Plugin/PongTest.php b/plugins/Irc/extlib/phergie/Tests/Phergie/Plugin/PongTest.php index a8bc8fd05f..e8351fef24 100644 --- a/plugins/Irc/extlib/phergie/Tests/Phergie/Plugin/PongTest.php +++ b/plugins/Irc/extlib/phergie/Tests/Phergie/Plugin/PongTest.php @@ -12,15 +12,13 @@ * http://phergie.org/license * * @category Phergie - * @package Phergie + * @package Phergie_Tests * @author Phergie Development Team * @copyright 2008-2010 Phergie Development Team (http://phergie.org) * @license http://phergie.org/license New BSD License - * @link http://pear.phergie.org/package/Phergie + * @link http://pear.phergie.org/package/Phergie_Tests */ -require_once(dirname(__FILE__) . '/TestCase.php'); - /** * Unit test suite for Pherge_Plugin_Pong. * @@ -28,47 +26,21 @@ require_once(dirname(__FILE__) . '/TestCase.php'); * @package Phergie_Tests * @author Phergie Development Team * @license http://phergie.org/license New BSD License - * @link http://pear.phergie.org/package/Phergie + * @link http://pear.phergie.org/package/Phergie_Tests */ class Phergie_Plugin_PongTest extends Phergie_Plugin_TestCase { /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() - { - $this->setPlugin(new Phergie_Plugin_Pong); - } - - /** - * Test that when a ping is received, a Phergie_Event_Command::TYPE_PONG - * is set to the handler + * Test that a pong event is sent when a ping event is received. * - * @event Phergie_Event_Command::TYPE_PING + * @return void */ - public function testOnPing() + public function testPong() { + $expected = 'irc.freenode.net'; + $event = $this->getMockEvent('ping', array($expected)); + $this->plugin->setEvent($event); + $this->assertEmitsEvent('pong', array($expected)); $this->plugin->onPing(); - $this->assertHasEvent(Phergie_Event_Command::TYPE_PONG); } - - /** - * Test that when a ping is received, a Phergie_Event_Command::TYPE_PONG - * is set to the handler - * - * @event Phergie_Event_Command::TYPE_PING - */ - public function testOnPingResponseArguement() - { - $this->plugin->onPing(); - $this->assertHasEvent(Phergie_Event_Command::TYPE_PONG); - $events = $this->getResponseEvents(Phergie_Event_Command::TYPE_PONG); - $this->assertTrue(count($events) === 1, 'Assert that only one pong is emitted'); - $this->assertEventEmitter(current($events), - $this->plugin, - 'Assert that the tested plugin emitted the event'); - - } - }