Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
frost-nzcr4 committed Sep 12, 2016
1 parent da91250 commit ac6bf98
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 28 deletions.
6 changes: 1 addition & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@
},
"autoload": {
"classmap": [
"core",
"http",
"xep",
"xmpp",
"jaxl.php"
"src/JAXL"
],
"exclude-from-classmap": [
"/tests/"
Expand Down
10 changes: 2 additions & 8 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@
<ruleset name="JAXL">
<description>The JAXL coding standard (based on PSR-2 excluding some rules).</description>

<file>core</file>
<file>examples</file>
<file>http</file>
<file>tests</file>
<file>xep</file>
<file>xmpp</file>
<file>jaxl.php</file>
<file>src/JAXL</file>
<file>jaxlctl</file>

<arg value="p"/>
Expand All @@ -28,9 +23,8 @@
<severity>0</severity>
</rule>

<!-- TODO: Register autoload (spl_autoload_register), remove include and require everywhere then remove this rule. -->
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
<severity>0</severity>
<exclude-pattern>examples</exclude-pattern>
</rule>

<!-- TODO: Rename all methods then remove this rule. -->
Expand Down
9 changes: 4 additions & 5 deletions src/JAXL/jaxl.php
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,10 @@ public function start(array $opts = array())
// emit
$this->ev->emit('on_disconnect');
} else {
// if connection to the destination fails

if ($this->trans->errno == 61
|| $this->trans->errno == 110
|| $this->trans->errno == 111
// If connection to the destination fails.
if ($this->trans->errno == 61 ||
$this->trans->errno == 110 ||
$this->trans->errno == 111
) {
JAXLLogger::debug("unable to connect with errno ".$this->trans->errno." (".$this->trans->errstr.")");
$this->retry();
Expand Down
8 changes: 1 addition & 7 deletions tests/JAXLLoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ class JAXLLoggerTest extends PHPUnit_Framework_TestCase
{

/**
* @runInSeparateProcess<--fixme
* @runInSeparateProcess
*/
public function testColorize()
{
$msg = 'Test message';

// TODO: Fix JAXL to run with @runInSeparateProcess and remove following line.
$current = JAXLLogger::$colorize;

JAXLLogger::$colorize = false;
$this->assertEquals($msg, JAXLLogger::colorize($msg, JAXLLogger::ERROR));

Expand All @@ -24,9 +21,6 @@ public function testColorize()
JAXLLogger::ERROR => $color
));
$this->assertEquals("\033[" . $color . "m" . $msg . "\033[0m", JAXLLogger::colorize($msg, JAXLLogger::ERROR));

// TODO: Fix JAXL to run with @runInSeparateProcess and remove following line.
JAXLLogger::$colorize = $current;
}

/**
Expand Down
7 changes: 4 additions & 3 deletions tests/JAXLTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public function testProtocolOption()
$config = array(
'host' => 'domain.tld',
'port' => 5223,
'protocol' => 'tcp'
'protocol' => 'tcp',
'strict' => false
);
$jaxl = new JAXL($config);
$this->assertEquals('tcp://domain.tld:5223', $jaxl->get_socket_path());
Expand All @@ -57,7 +58,7 @@ public function testProtocolOption()

public function testConfig()
{
$config = array();
$config = array('strict' => false);
$jaxl = new JAXL($config);

$this->assertEquals('PLAIN', $jaxl->cfg['auth_type']);
Expand All @@ -79,6 +80,6 @@ public function testConfig()
$this->assertNull($jaxl->cfg['protocol']);
$this->assertNull($jaxl->cfg['resource']);
$this->assertNull($jaxl->cfg['stream_context']);
$this->assertTrue($jaxl->cfg['strict']);
$this->assertFalse($jaxl->cfg['strict']);
}
}
1 change: 1 addition & 0 deletions tests/JAXLXmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class JAXLXmlTest extends PHPUnit_Framework_TestCase
public static $attrs = array('attr1' => 'value1');

/**
* @runInSeparateProcess-
* @expectedException PHPUnit_Framework_Error_Warning
*/
public function testJAXLXml_0()
Expand Down

0 comments on commit ac6bf98

Please sign in to comment.