87 lines
2.3 KiB
PHP
87 lines
2.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* DomFramework - Tests
|
|
* @package domframework
|
|
* @author Dominique Fournier <dominique@fournier38.fr>
|
|
* @license BSD
|
|
*/
|
|
|
|
namespace Domframework\Tests;
|
|
|
|
use Domframework\Xmppclient;
|
|
|
|
/**
|
|
* Test the domframework xmppclient part
|
|
*/
|
|
class xmppclientTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
public function testConnectionBADNAME()
|
|
{
|
|
$this->expectException("Exception");
|
|
$xmppclient = new Xmppclient();
|
|
$res = $xmppclient->connect("NOTFOUND.fournier38.fr", 5222, "", "");
|
|
}
|
|
|
|
public function testConnectionAuthenticate1()
|
|
{
|
|
$xmppclient = new Xmppclient();
|
|
$res = $xmppclient->connect(
|
|
"xmpp.fournier38.fr",
|
|
5222,
|
|
"testxmpp@xmpp.fournier38.fr",
|
|
"LSqmBXDUZWxk"
|
|
);
|
|
$this->assertSame(is_object($res), true);
|
|
}
|
|
|
|
public function testConnectionDisco1()
|
|
{
|
|
$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 testConnectionSendMessage1()
|
|
{
|
|
$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 testConnectionSendMessage2()
|
|
{
|
|
$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);
|
|
}
|
|
}
|