Improve wp acorn compability

This commit is contained in:
Jan-Niclas Loosen
2026-06-29 19:54:12 +02:00
parent 7f3fd36186
commit 102abe7927
28 changed files with 4090 additions and 1980 deletions
+50
View File
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace AcornPlugin\Tests\Acorn;
use AcornPlugin\Acorn\BootCoordinator;
use AcornPlugin\Tests\TestCase;
use Brain\Monkey\Functions;
final class BootCoordinatorTest extends TestCase
{
// -----------------------------------------------------------------------
// shouldBoot()
// -----------------------------------------------------------------------
public function test_should_boot_returns_true_when_action_has_not_fired(): void
{
Functions\when('did_action')->justReturn(0);
$result = (new BootCoordinator())->shouldBoot();
$this->assertTrue($result);
}
public function test_should_boot_returns_false_when_action_already_fired(): void
{
Functions\expect('did_action')
->once()
->with(BootCoordinator::BOOTED_ACTION)
->andReturn(1);
$result = (new BootCoordinator())->shouldBoot();
$this->assertFalse($result);
}
// -----------------------------------------------------------------------
// markBooted()
// -----------------------------------------------------------------------
public function test_mark_booted_fires_the_booted_action_once(): void
{
Functions\expect('do_action')
->once()
->with(BootCoordinator::BOOTED_ACTION);
(new BootCoordinator())->markBooted();
}
}