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.
31 lines
660 B
31 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));
|
|
}
|
|
}
|
|
|