/** * Tests changeUserNick(). */ public function testChangeUserNick() { $otherChannel = '#channel1'; $otherNick = 'otherNick'; $event = $this->getMockUserModeEvent('+', $otherChannel, $otherNick); $connection = $event->getConnection(); $this->plugin->changeUserMode($event, $this->queue); $oldNick = 'old'; $newNick = 'new'; $channel = '#channel2'; $mode = 'o'; $event = $this->getMockUserModeEvent('+', $channel, $oldNick); $this->plugin->changeUserMode($event, $this->queue); $event = $this->getMockUserEvent(); $params = array('nickname' => $newNick); Phake::when($event)->getParams()->thenReturn($params); Phake::when($event)->getConnection()->thenReturn($connection); Phake::when($event)->getNick()->thenReturn($oldNick); $this->plugin->changeUserNick($event, $this->queue); $this->assertFalse($this->plugin->userHasMode($connection, $channel, $oldNick, $mode)); $this->assertFalse($this->plugin->userHasMode($connection, $otherChannel, $oldNick, $mode)); $this->assertTrue($this->plugin->userHasMode($connection, $channel, $newNick, $mode)); $this->assertFalse($this->plugin->userHasMode($connection, $otherChannel, $newNick, $mode)); $this->assertFalse($this->plugin->userHasMode($connection, $channel, $otherNick, $mode)); $this->assertTrue($this->plugin->userHasMode($connection, $otherChannel, $otherNick, $mode)); }