Last active
November 25, 2020 09:04
-
-
Save chillbits-legacy/ca27c838266145f2dcada7f0ed6c2282 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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