protected function EventTrackerServiceTest::setUp in Commerce Google Tag Manager 8.2
Same name in this branch
- 8.2 tests/src/Unit/EventTrackerServiceTest.php \Drupal\Tests\commerce_google_tag_manager\Unit\EventTrackerServiceTest::setUp()
- 8.2 tests/src/Kernel/EventTrackerServiceTest.php \Drupal\Tests\commerce_google_tag_manager\Kernel\EventTrackerServiceTest::setUp()
Same name and namespace in other branches
- 8 tests/src/Unit/EventTrackerServiceTest.php \Drupal\Tests\commerce_google_tag_manager\Unit\EventTrackerServiceTest::setUp()
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ EventTrackerServiceTest.php, line 49
Class
- EventTrackerServiceTest
- Tests for the EventTracker service.
Namespace
Drupal\Tests\commerce_google_tag_manager\UnitCode
protected function setUp() {
parent::setUp();
$this->eventStorage = $this
->getMockBuilder(EventStorageService::class)
->disableOriginalConstructor()
->getMock();
$event_dispatcher = $this
->prophesize(EventDispatcherInterface::class);
$current_store = $this
->prophesize(CurrentStoreInterface::class);
$current_user = $this
->prophesize(AccountInterface::class);
$price_calculator = $this
->prophesize(PriceCalculatorInterface::class);
$store = $this
->prophesize(StoreInterface::class);
$current_store
->getStore()
->willReturn($store
->reveal());
$price = new Price('50.00', 'USD');
$price_calc_result = new PriceCalculatorResult($price, $price);
$price_calculator
->calculate(Argument::any(), Argument::any(), Argument::any())
->willReturn($price_calc_result);
$this->eventTracker = new EventTrackerService($this->eventStorage, $event_dispatcher
->reveal(), $current_store
->reveal(), $current_user
->reveal(), $price_calculator
->reveal());
}