Skip to content

Instantly share code, notes, and snippets.

@chillbits-legacy
Last active November 25, 2020 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chillbits-legacy/ca27c838266145f2dcada7f0ed6c2282 to your computer and use it in GitHub Desktop.
Save chillbits-legacy/ca27c838266145f2dcada7f0ed6c2282 to your computer and use it in GitHub Desktop.
<?php
namespace Tests\Unit;
use Illuminate\Contracts\Container\BindingResolutionException;
use Tests\TestCase;
use function Brain\Monkey\Functions\when;
use function Bree\boot;
use function Bree\app;
class PluginBootingTest extends TestCase
{
protected $app;
public function setUp(): void
{
parent::setUp();
when('get_option')->justReturn(true);
try {
boot();
$this->app = app();
} catch (BindingResolutionException $e) {
$this->assertFalse(true);
}
}
public function test_plugin_booted_successfully()
{
$this->assertTrue($this->app->isBooted());
$this->assertTrue(1 === did_action('bree_booted'));
}
public function test_features_loaded_successfully()
{
$expectingFeatures = [
'Bree\Features\Cart\BreeItem',
'Bree\Features\Cart\BreeThumbnail',
'Bree\Features\Cart\DisableCartUpdate',
'Bree\Features\Account\AuthenticatedPages',
'Bree\Features\Account\UpdateLayoutMyAccount',
'Bree\Features\Checkout\AddShippingPhoneToCheckout',
'Bree\Features\Checkout\UpdateLayoutCheckout',
'Bree\Features\Product\ProductSync',
'Bree\Features\Product\UpdateLayoutSingleProduct',
'Bree\Features\Order\ShowItemMeta',
'Bree\Features\Order\OrderProgress',
'Bree\Features\Order\OrderEnquire',
'Bree\Features\Order\SendOrderToPa',
];
foreach ($expectingFeatures as $feature) {
$this->assertTrue($this->app->resolved($feature));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment