blob: e76020b6b3783bf369f6eef759eb83cd77b74038 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
<?php
/**
* Phergie
*
* PHP version 5
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.
* It is also available through the world-wide-web at this URL:
* http://phergie.org/license
*
* @category Phergie
* @package Phergie
* @author Phergie Development Team <team@phergie.org>
* @copyright 2008-2010 Phergie Development Team (http://phergie.org)
* @license http://phergie.org/license New BSD License
* @link http://pear.phergie.org/package/Phergie
*/
require_once(dirname(__FILE__) . '/TestCase.php');
/**
* Unit test suite for Pherge_Plugin_TerryChay.
*
* @category Phergie
* @package Phergie_Tests
* @author Phergie Development Team <team@phergie.org>
* @license http://phergie.org/license New BSD License
* @link http://pear.phergie.org/package/Phergie
*/
class Phergie_Plugin_TerryChayTest 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_TerryChay());
$config = new Phergie_Config();
$handler = new Phergie_Plugin_Handler($config, $this->handler);
$this->plugin->setPluginHandler($handler);
$handler->addPlugin($this->plugin);
$handler->addPlugin(new Phergie_Plugin_Http($config));
$this->plugin->setConfig($config);
$this->connection->setNick('phergie');
$this->plugin->onLoad();
}
/**
* @event Phergie_Event_Request::privmsg
* @eventArg #zftalk
* @eventArg tychay
*/
public function testWithTyChay()
{
$this->plugin->onPrivMsg();
$this->assertHasEvent(Phergie_Event_Command::TYPE_PRIVMSG);
}
/**
* @event Phergie_Event_Request::privmsg
* @eventArg #zftalk
* @eventArg terrychay
*/
public function testWithTerryChay()
{
$this->plugin->onPrivMsg();
$this->assertDoesNotHaveEvent(Phergie_Event_Command::TYPE_PRIVMSG,
'string "terrychay" should not invoke a response');
}
/**
* @event Phergie_Event_Request::privmsg
* @eventArg #zftalk
* @eventArg terry chay
*/
public function testWithTerry_Chay()
{
$this->plugin->onPrivMsg();
$this->assertHasEvent(Phergie_Event_Command::TYPE_PRIVMSG,
'string "terry chay" should invoke a response');
}
/**
* @event Phergie_Event_Request::privmsg
* @eventArg #zftalk
* @eventArg Elazar is not Mr. Chay
*/
public function testWithNoTyChay()
{
$this->plugin->onPrivMsg();
$this->assertDoesNotHaveEvent(Phergie_Event_Command::TYPE_PRIVMSG,
'Failed asserting that elazar is not ' .
'tychay');
}
}
|