mirror of
https://github.com/php-win-ext/phpy.git
synced 2026-03-25 01:12:16 +01:00
* fix core dump when "new PyType"
* add test code
---------
Co-authored-by: 弄月 <{ID}+{username}@users.noreply.github.com>
26 lines
550 B
PHP
26 lines
550 B
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class TypeTest extends TestCase
|
|
{
|
|
function testType()
|
|
{
|
|
$type = PyCore::type(1);
|
|
$this->assertTrue($type instanceof PyType);
|
|
|
|
$this->assertEquals("<class 'int'>", (string)$type);
|
|
}
|
|
|
|
function testNewType()
|
|
{
|
|
try {
|
|
new PyType;
|
|
} catch (Error $error) {
|
|
$this->assertStringContainsString('private PyType::__construct()', $error->getMessage());
|
|
$success = false;
|
|
}
|
|
$this->assertFalse($success);
|
|
}
|
|
}
|