Skip to content

Commit

Permalink
fix test in php 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
aldas committed Nov 15, 2017
1 parent 71e0cda commit a984acf
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/unit/Packet/QuadWordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use ModbusTcpClient\Packet\Word;
use ModbusTcpClient\Utils\Endian;
use PHPUnit\Framework\TestCase;
use PHPUnit_Framework_Error;

class QuadWordTest extends TestCase
{
Expand Down Expand Up @@ -59,6 +60,7 @@ public function testShouldCreateFromWords()
}

/**
* @requires PHP 7
* @expectedException \TypeError
*/
public function testShouldNotCreateFromWordsWhenParamNotWord()
Expand All @@ -70,4 +72,24 @@ public function testShouldNotCreateFromWordsWhenParamNotWord()
null
);
}

public function testShouldNotCreateFromWordsWhenParamNotWord56()
{
if (PHP_VERSION_ID >= 70000) {
$this->markTestSkipped('is for PHP 5.6.x');
}

$ok = false;
try {
QuadWord::fromWords(
new Word("\x01\x02"),
new Word("\x03\x04"),
new Word("\x05\x06"),
null
);
} catch (PHPUnit_Framework_Error $exception) {
$ok = true;
}
$this->assertTrue($ok);
}
}

0 comments on commit a984acf

Please sign in to comment.