Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Enhance EventQueue test so it can properly test the new ircWhois para…
Browse files Browse the repository at this point in the history
…meter order
  • Loading branch information
hashworks committed Jun 10, 2015
1 parent 6f5e58c commit b11296a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/EventQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,21 @@ protected function setUp()
* @param string $method
* @param string $command
* @param array $params
* @param array $event_params
* @param string|null $prefix
* @dataProvider dataProviderIrcEvents
*/
public function testIrcEvents($method, $command, array $params = array(), $prefix = null)
public function testIrcEvents($method, $command, array $params = array(), array $event_params = null, $prefix = null)
{
if ($event_params == null) {
$event_params = $params;
}
$this->queue->setPrefix($prefix);
call_user_func_array(array($this->queue, $method), $params);
$event = $this->queue->extract();
$this->assertInstanceOf('\Phergie\Irc\Event\UserEvent', $event);
$this->assertSame($command, $event->getCommand());
$this->assertSame($params, $event->getParams());
$this->assertSame($event_params, $event->getParams());
$this->assertSame($prefix, $event->getPrefix());
}

Expand Down Expand Up @@ -89,7 +93,7 @@ public function dataProviderIrcEvents()
array('ircPrivmsg', 'PRIVMSG', array('receivers', 'text')),
array('ircNotice', 'NOTICE', array('nickname', 'text')),
array('ircWho', 'WHO', array('name', 'o')),
array('ircWhois', 'WHOIS', array('nickmasks', 'server')),
array('ircWhois', 'WHOIS', array('nickmasks', 'server'), array('server', 'nickmasks')),
array('ircWhowas', 'WHOWAS', array('nickname', 'count', 'server')),
array('ircKill', 'KILL', array('nickname', 'comment')),
array('ircPing', 'PING', array('server1', 'server2')),
Expand All @@ -107,8 +111,11 @@ public function dataProviderIrcEvents()
);

foreach ($data as $value) {
if (!is_array(end($value))) {
if (count($value) == 2) {
$value[] = array();
$value[] = null;
} elseif (count($value) == 3) {
$value[] = null;
}
$value[] = 'prefix';
$data[] = $value;
Expand Down

0 comments on commit b11296a

Please sign in to comment.