Modbus TCP and UDP library for PHP., originally from code.google.com/p/phpmodbus
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
php-modbus/tests/PhpType/PhpTypeArrayExceptionWithTe...

32 lines
660 B

<?php
namespace Tests\PhpType;
use PHPModbus\PhpType;
use PHPUnit\Framework\TestCase;
class PhpTypeArrayExceptionWithTextArrayTest extends TestCase
{
private $data = [
"0" => 100, // 32098 (DINT)
"1" => "e",
"2" => 0,
"3" => 0
];
/**
* @expectedException \Exception
*/
public function testExceptionWhenSize2ContainsString()
{
PhpType::bytes2unsignedInt(array_slice($this->data, 0, 2));
}
/**
* @expectedException \Exception
*/
public function testExceptionWhenSize4ContainsString()
{
PhpType::bytes2unsignedInt(array_slice($this->data, 0, 4));
}
}