Improve wp acorn compability
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user