<?php

declare(strict_types=1);

$ctx = require dirname(__DIR__) . '/bootstrap.php';

$wp = $ctx['wp'];
assert($wp instanceof FecaMailshots\WordPress\FixtureWordPressFacade);

$action = isset($_REQUEST['action']) ? (string) $_REQUEST['action'] : '';
if ($action === '') {
    http_response_code(400);
    echo 'Missing action';
    exit;
}

$hook = 'admin_post_' . $action;
$wp->dispatch($hook);
