-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap-plugin.php
More file actions
34 lines (31 loc) · 1.05 KB
/
bootstrap-plugin.php
File metadata and controls
34 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* Plugin Name: Harbor Test Bootstrap
* Description: Bootstraps LiquidWeb Harbor during plugins_loaded, before wp_loaded fires.
* Version: 1.0.0
* Author: Liquid Web
*/
use StellarWP\ContainerContract\ContainerInterface;
use LiquidWeb\Harbor\Config;
use LiquidWeb\Harbor\Tests\Container;
use LiquidWeb\Harbor\Harbor;
// Mock a premium plugin so Premium_Plugin_Registry::any() returns true during
// the WP boot phase and Harbor::init() actually registers its providers. Without
// this the premium-plugin gate inside Harbor::init() short-circuits and tests
// that depend on provider bindings (License_Repository, Portal_Client, etc.)
// or on hooks added by provider register_hooks() observe an empty container.
add_filter(
'lw_harbor/premium_plugin_exists',
'__return_true'
);
add_action(
'plugins_loaded',
static function () {
$container = new Container();
$container->singleton( ContainerInterface::class, $container );
Config::set_plugin_basename( plugin_basename( __FILE__ ) );
Config::set_container( $container );
Harbor::init();
},
0
);