Skip to content

Instantly share code, notes, and snippets.

@chillbits-legacy
Created March 17, 2021 05:35
Show Gist options
  • Save chillbits-legacy/4e83e28e59e8685c97076a63810601f9 to your computer and use it in GitHub Desktop.
Save chillbits-legacy/4e83e28e59e8685c97076a63810601f9 to your computer and use it in GitHub Desktop.
<?php
namespace Tests\Feature\Cart;
use Bree\Features\Cart\MaybeAddBoxesToCart;
use Tests\TestCase;
use Mockery as m;
use function Bree\boot_without_features;
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
class AddBoxesToCartTest extends TestCase
{
/**
* @var MaybeAddBoxesToCart
*/
protected MaybeAddBoxesToCart $feature;
public function setUp(): void
{
parent::setUp();
$this->bootFeature();
$this->feature->__invoke();
do_action('bree_after_item_added_to_cart');
}
private function bootFeature()
{
boot_without_features();
$this->feature = new MaybeAddBoxesToCart;
}
public function test_the_feature_should_run_after_an_item_added_to_cart()
{
$this->assertSame(
10,
has_action(
'bree_after_item_added_to_cart',
'Bree\Features\Cart\MaybeAddBoxesToCart->process()'
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment