nur-sery/tests/wip/php/funcTest.php

37 lines
1.3 KiB
PHP
Raw Normal View History

2024-09-10 17:38:42 +04:00
<?php
namespace {
function tltf_zero(): int { return 0; }
}
namespace nur\sery\wip\php\impl {
function nptf_zero(): int { return 0; }
}
namespace nur\sery\wip\php {
use nulib\tests\TestCase;
class funcTest extends TestCase {
function testSimple() {
$func = null; self::assertFalse(func::verifix_simple($func));
$func = false; self::assertFalse(func::verifix_simple($func));
$func = ""; self::assertFalse(func::verifix_simple($func));
$func = 'tltf_zero'; self::assertTrue(func::verifix_simple($func));
self::assertSame([false, "tltf_zero"], $func);
$func = 'tltf_zero'; self::assertTrue(func::verifix_simple($func, false));
self::assertSame([false, "tltf_zero"], $func);
$func = 'nur\sery\wip\php\impl\nptf_zero'; self::assertTrue(func::verifix_simple($func));
self::assertSame([false, 'nur\sery\wip\php\impl\nptf_zero'], $func);
$func = 'nur\sery\wip\php\impl\nptf_zero'; self::assertTrue(func::verifix_simple($func, false));
self::assertSame([false, 'nur\sery\wip\php\impl\nptf_zero'], $func);
$func = 'inexistant_function_xxx'; self::assertFalse(func::verifix_simple($func));
$func = 'inexistant_function_xxx'; self::assertTrue(func::verifix_simple($func, false));
self::assertSame([false, "inexistant_function_xxx"], $func);
}
}
}