NotifyGrantEventTest.php in Ubercart 8.4
File
uc_file/tests/src/Unit/Integration/Event/NotifyGrantEventTest.php
View source
<?php
namespace Drupal\Tests\uc_file\Unit\Integration\Event;
use Drupal\rules\Core\RulesEventManager;
use Drupal\Tests\rules\Unit\Integration\Event\EventTestBase;
class NotifyGrantEventTest extends EventTestBase {
protected function setUp() : void {
parent::setUp();
$this
->enableModule('uc_file', [
'Drupal\\uc_file' => __DIR__ . '/../../../../../src',
]);
$this->moduleHandler
->getModuleDirectories()
->willReturn([
'uc_file' => __DIR__ . '/../../../../../',
]);
$this->eventManager = new RulesEventManager($this->moduleHandler
->reveal(), $this->entityTypeBundleInfo
->reveal());
}
public function testNotifyGrantEvent() {
$event = $this->eventManager
->createInstance('uc_file_notify_grant');
$order_context_definition = $event
->getContextDefinition('order');
$this
->assertSame('entity:uc_order', $order_context_definition
->getDataType());
$this
->assertSame('Order', $order_context_definition
->getLabel());
$file_context_definition = $event
->getContextDefinition('expiration');
$this
->assertSame('array', $file_context_definition
->getDataType());
$this
->assertSame('File expiration', $file_context_definition
->getLabel());
}
}