XMPP Client : basic message send to XMPP server
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5912 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
55
Tests/xmppclientTest.php
Normal file
55
Tests/xmppclientTest.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/** DomFramework
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
*/
|
||||
|
||||
/** Test the domframework xmppclient part */
|
||||
class xmppclientTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_connection_BADNAME ()
|
||||
{
|
||||
$this->expectException ("Exception");
|
||||
$xmppclient = new xmppclient ();
|
||||
$res = $xmppclient->connect ("NOTFOUND.fournier38.fr", 5222, "", "");
|
||||
}
|
||||
|
||||
public function test_connection_authenticate_1 ()
|
||||
{
|
||||
$xmppclient = new xmppclient ();
|
||||
$res = $xmppclient->connect ("xmpp.fournier38.fr", 5222,
|
||||
"testxmpp@xmpp.fournier38.fr", "LSqmBXDUZWxk");
|
||||
$this->assertSame (is_object ($res), true);
|
||||
}
|
||||
|
||||
public function test_connection_disco_1 ()
|
||||
{
|
||||
$xmppclient = new xmppclient ();
|
||||
$xmppclient->connect ("xmpp.fournier38.fr", 5222,
|
||||
"testxmpp@xmpp.fournier38.fr", "LSqmBXDUZWxk");
|
||||
$res = $xmppclient->discoveryService ();
|
||||
$this->assertSame (is_array ($res) && count ($res) > 5, true);
|
||||
}
|
||||
|
||||
public function test_connection_sendMessage_1 ()
|
||||
{
|
||||
$xmppclient = new xmppclient ();
|
||||
$xmppclient->connect ("xmpp.fournier38.fr", 5222,
|
||||
"testxmpp@xmpp.fournier38.fr", "LSqmBXDUZWxk");
|
||||
$res = $xmppclient->sendMessagePrivate ("dominique@fournier38.fr",
|
||||
"DFW TEST XMPP : test_connection_sendMessage_1");
|
||||
$this->assertSame (is_object ($res), true);
|
||||
}
|
||||
|
||||
public function test_connection_sendMessage_2 ()
|
||||
{
|
||||
$xmppclient = new xmppclient ();
|
||||
$xmppclient->connect ("xmpp.fournier38.fr", 5222,
|
||||
"testxmpp@xmpp.fournier38.fr", "LSqmBXDUZWxk");
|
||||
$res = $xmppclient->sendMessagePrivate ("dominique@fournier38.fr",
|
||||
"DFW TEST XMPP : test_connection_sendMessage_2 : MESSAGE 1");
|
||||
$res = $xmppclient->sendMessagePrivate ("dominique@fournier38.fr",
|
||||
"DFW TEST XMPP : test_connection_sendMessage_2 : MESSAGE 2");
|
||||
$this->assertSame (is_object ($res), true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user