mirror of
https://github.com/php-win-ext/phpy.git
synced 2026-03-26 01:42:09 +01:00
34 lines
796 B
PHP
34 lines
796 B
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class IterTest extends TestCase
|
|
{
|
|
function testIter()
|
|
{
|
|
$platform = PyCore::import('platform');
|
|
$uname = $platform->uname();
|
|
|
|
$iter = PyCore::iter($uname);
|
|
$this->assertTrue($iter instanceof PyIter);
|
|
|
|
$list = [];
|
|
while ($next = PyCore::next($iter)) {
|
|
$list[] = PyCore::scalar($next);
|
|
}
|
|
$this->assertIsArray($list);
|
|
$this->assertGreaterThanOrEqual(5, count($list));
|
|
}
|
|
|
|
function testNewIter()
|
|
{
|
|
try {
|
|
new PyIter;
|
|
} catch (Error $error) {
|
|
$this->assertStringContainsString('private PyIter::__construct()', $error->getMessage());
|
|
$success = false;
|
|
}
|
|
$this->assertFalse($success);
|
|
}
|
|
}
|