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.
27 lines
651 B
27 lines
651 B
<?php
|
|
namespace Tests\PhpType;
|
|
|
|
use PHPModbus\PhpType;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class PhpTypeArrayExceptionWithTextArrayTest extends TestCase
|
|
{
|
|
const DATA = [
|
|
"0" => 100, // 32098 (DINT)
|
|
"1" => "e",
|
|
"2" => 0,
|
|
"3" => 0
|
|
];
|
|
|
|
public function testExceptionWhenSize2ContainsString()
|
|
{
|
|
$this->expectException(\Exception::class);
|
|
PhpType::bytes2unsignedInt(array_slice(self::DATA, 0, 2));
|
|
}
|
|
|
|
public function testExceptionWhenSize4ContainsString()
|
|
{
|
|
$this->expectException(\Exception::class);
|
|
PhpType::bytes2unsignedInt(array_slice(self::DATA, 0, 4));
|
|
}
|
|
}
|
|
|