Skip to content

Commit ac6bf98

Browse files
committed
Update tests
1 parent da91250 commit ac6bf98

File tree

6 files changed

+13
-28
lines changed

6 files changed

+13
-28
lines changed

composer.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@
3535
},
3636
"autoload": {
3737
"classmap": [
38-
"core",
39-
"http",
40-
"xep",
41-
"xmpp",
42-
"jaxl.php"
38+
"src/JAXL"
4339
],
4440
"exclude-from-classmap": [
4541
"/tests/"

phpcs.xml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22
<ruleset name="JAXL">
33
<description>The JAXL coding standard (based on PSR-2 excluding some rules).</description>
44

5-
<file>core</file>
65
<file>examples</file>
7-
<file>http</file>
8-
<file>tests</file>
9-
<file>xep</file>
10-
<file>xmpp</file>
11-
<file>jaxl.php</file>
6+
<file>src/JAXL</file>
127
<file>jaxlctl</file>
138

149
<arg value="p"/>
@@ -28,9 +23,8 @@
2823
<severity>0</severity>
2924
</rule>
3025

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

3630
<!-- TODO: Rename all methods then remove this rule. -->

src/JAXL/jaxl.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,10 @@ public function start(array $opts = array())
479479
// emit
480480
$this->ev->emit('on_disconnect');
481481
} else {
482-
// if connection to the destination fails
483-
484-
if ($this->trans->errno == 61
485-
|| $this->trans->errno == 110
486-
|| $this->trans->errno == 111
482+
// If connection to the destination fails.
483+
if ($this->trans->errno == 61 ||
484+
$this->trans->errno == 110 ||
485+
$this->trans->errno == 111
487486
) {
488487
JAXLLogger::debug("unable to connect with errno ".$this->trans->errno." (".$this->trans->errstr.")");
489488
$this->retry();

tests/JAXLLoggerTest.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@ class JAXLLoggerTest extends PHPUnit_Framework_TestCase
44
{
55

66
/**
7-
* @runInSeparateProcess<--fixme
7+
* @runInSeparateProcess
88
*/
99
public function testColorize()
1010
{
1111
$msg = 'Test message';
1212

13-
// TODO: Fix JAXL to run with @runInSeparateProcess and remove following line.
14-
$current = JAXLLogger::$colorize;
15-
1613
JAXLLogger::$colorize = false;
1714
$this->assertEquals($msg, JAXLLogger::colorize($msg, JAXLLogger::ERROR));
1815

@@ -24,9 +21,6 @@ public function testColorize()
2421
JAXLLogger::ERROR => $color
2522
));
2623
$this->assertEquals("\033[" . $color . "m" . $msg . "\033[0m", JAXLLogger::colorize($msg, JAXLLogger::ERROR));
27-
28-
// TODO: Fix JAXL to run with @runInSeparateProcess and remove following line.
29-
JAXLLogger::$colorize = $current;
3024
}
3125

3226
/**

tests/JAXLTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ public function testProtocolOption()
4848
$config = array(
4949
'host' => 'domain.tld',
5050
'port' => 5223,
51-
'protocol' => 'tcp'
51+
'protocol' => 'tcp',
52+
'strict' => false
5253
);
5354
$jaxl = new JAXL($config);
5455
$this->assertEquals('tcp://domain.tld:5223', $jaxl->get_socket_path());
@@ -57,7 +58,7 @@ public function testProtocolOption()
5758

5859
public function testConfig()
5960
{
60-
$config = array();
61+
$config = array('strict' => false);
6162
$jaxl = new JAXL($config);
6263

6364
$this->assertEquals('PLAIN', $jaxl->cfg['auth_type']);
@@ -79,6 +80,6 @@ public function testConfig()
7980
$this->assertNull($jaxl->cfg['protocol']);
8081
$this->assertNull($jaxl->cfg['resource']);
8182
$this->assertNull($jaxl->cfg['stream_context']);
82-
$this->assertTrue($jaxl->cfg['strict']);
83+
$this->assertFalse($jaxl->cfg['strict']);
8384
}
8485
}

tests/JAXLXmlTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class JAXLXmlTest extends PHPUnit_Framework_TestCase
77
public static $attrs = array('attr1' => 'value1');
88

99
/**
10+
* @runInSeparateProcess-
1011
* @expectedException PHPUnit_Framework_Error_Warning
1112
*/
1213
public function testJAXLXml_0()

0 commit comments

Comments
 (0)