Files
wp-multi-city/tests/PluginBootS7Test.php
T
Vladimir Bryzgalov 43815dea2d
tests / phpunit (push) Has been cancelled
refactor(wpmc S7): tighten tests + cleanup bootstrap shims
- PluginBootS7Test idempotency: assertTrue(class_exists) instead of assertTrue(true)
- ZipArchiveBuildTest: try/finally cleanup + unzip exit-code check
- bootstrap.php: drop unused PUC shims (wp_remote_post, transient*)
- CHANGELOG.md: header references Keep a Changelog (was: mirrors readme.txt)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 12:31:07 +05:00

50 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace WPMultiCity\Tests;
use Brain\Monkey\Functions;
use ReflectionClass;
use WPMultiCity\Plugin;
final class PluginBootS7Test extends TestCase
{
protected function setUp(): void
{
parent::setUp();
$plugin = Plugin::instance();
$reflection = new ReflectionClass($plugin);
$prop = $reflection->getProperty('booted');
$prop->setValue($plugin, false);
}
public function test_boot_loads_puc_factory(): void
{
if (!class_exists('ACF', false)) {
eval('class ACF {}');
}
Plugin::instance()->boot();
self::assertTrue(
class_exists('YahnisElsts\\PluginUpdateChecker\\v5\\PucFactory'),
'boot() should require PUC loader and make PucFactory available'
);
}
public function test_boot_double_call_is_idempotent(): void
{
if (!class_exists('ACF', false)) {
eval('class ACF {}');
}
Plugin::instance()->boot();
Plugin::instance()->boot();
self::assertTrue(
class_exists('YahnisElsts\\PluginUpdateChecker\\v5\\PucFactory'),
'PucFactory must still be loaded after double boot()'
);
}
}